Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
grew
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
grew
grew
Commits
b7ca94ed
Commit
b7ca94ed
authored
Feb 19, 2018
by
Bruno Guillaume
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enriched grep mode (produces dep files)
parent
c1ecd2fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
_tags
_tags
+1
-1
src/grew_args.ml
src/grew_args.ml
+2
-0
src/grew_corpus.ml
src/grew_corpus.ml
+25
-2
No files found.
_tags
View file @
b7ca94ed
true: package(yojson, containers, str, ANSITerminal, log, conll)
true: bin_annot
\ No newline at end of file
true: bin_annot
src/grew_args.ml
View file @
b7ca94ed
...
...
@@ -20,6 +20,7 @@ module Grew_args = struct
let
grs
=
ref
None
let
gui_doc
=
ref
false
let
old_grs
=
ref
false
let
dep_dir
=
ref
None
let
(
input_data
:
string
option
ref
)
=
ref
None
let
(
output_file
:
string
option
ref
)
=
ref
None
...
...
@@ -112,6 +113,7 @@ module Grew_args = struct
|
"-debug"
::
args
->
libgrew_debug_mode
()
;
loop
args
|
"-debug_loop"
::
args
->
Rewrite
.
set_debug_loop
()
|
"-dep_dir"
::
dir
::
args
->
dep_dir
:=
Some
dir
|
x
->
Log
.
fwarning
"Ignored arguments: %s"
(
String
.
concat
" "
x
)
...
...
src/grew_corpus.ml
View file @
b7ca94ed
...
...
@@ -90,14 +90,37 @@ let transform () =
(* get the array of graphs to explore *)
let
graph_array
=
Corpus
.
get_graphs
?
domain
data_file
in
(
match
!
Grew_args
.
dep_dir
with
|
None
->
()
|
Some
d
->
ignore
(
Sys
.
command
(
sprintf
"mkdir -p %s"
d
)));
(* printf "%s\n" (String.concat "_" (Pattern.pid_name_list pattern)); *)
let
pattern_ids
=
Pattern
.
pid_name_list
pattern
in
Array
.
iter
(
fun
(
name
,
graph
)
->
let
matchings
=
Graph
.
search_pattern
?
domain
pattern
graph
in
List
.
iter
(
fun
matching
->
let
node_matching
=
Graph
.
node_matching
pattern
graph
matching
in
let
graph_node_id
=
List
.
assoc
node_id
node_matching
in
printf
"%s
\t
%g
\n
"
name
graph_node_id
let
graph_node_ids
=
List
.
map
snd
node_matching
in
let
deco
=
Deco
.
build
pattern
matching
in
let
html
=
Graph
.
to_sentence
~
deco
graph
in
let
id
=
sprintf
"%s__%s"
name
(
String
.
concat
"_"
(
List
.
map2
(
sprintf
"%s:%g"
)
pattern_ids
graph_node_ids
))
in
(* let graph_node_id = List.assoc node_id node_matching in *)
(* printf "%s\t%g\n" name graph_node_id; *)
printf
"%s@@%s
\n
"
id
html
;
(
match
!
Grew_args
.
dep_dir
with
|
None
->
()
|
Some
dir
->
let
dep
=
Graph
.
to_dep
~
deco
graph
in
let
filename
=
sprintf
"%s.dep"
id
in
let
out_ch
=
open_out
(
Filename
.
concat
dir
filename
)
in
fprintf
out_ch
"%s"
dep
;
close_out
out_ch
)
)
matchings
)
graph_array
)
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment