Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WCCL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
WCCL
Commits
b90d32e0
Commit
b90d32e0
authored
Apr 21, 2011
by
Adam Wardynski
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of nlp.pwr.wroc.pl:wccl
parents
592ba564
3f4500b3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
wccl-apps/wccl-match.cpp
+30
-6
30 additions, 6 deletions
wccl-apps/wccl-match.cpp
wccl-apps/wccl-rules.cpp
+21
-6
21 additions, 6 deletions
wccl-apps/wccl-rules.cpp
with
51 additions
and
12 deletions
wccl-apps/wccl-match.cpp
+
30
−
6
View file @
b90d32e0
...
...
@@ -102,6 +102,14 @@ void MatchRunner::apply_rules(boost::shared_ptr<Corpus2::TokenReader> reader,
}
}
void
usage
(
char
*
name
)
{
std
::
cerr
<<
"This program runs WCCL match rules.
\n
"
;
std
::
cerr
<<
"Usage "
<<
name
<<
" [OPTIONS] FILES
\n
"
<<
"Files ending with .xml are treated as corpora, otherwise
\n
"
<<
"as CCL files. Use - to read corpus from stdin (as with -I)
\n
"
;
}
int
main
(
int
argc
,
char
**
argv
)
{
std
::
string
tagset_load
=
"kipi"
;
...
...
@@ -130,6 +138,8 @@ int main(int argc, char** argv)
"CCL rule files
\n
"
)
(
"files,f"
,
value
(
&
files
),
"Files to load, looking at the extension to determine type
\n
"
)
(
"corpus-from-stdin,I"
,
value
(
&
corpus_stdin
)
->
zero_tokens
(),
"Read corpus from stdin"
)
(
"input-format,i"
,
value
(
&
input_format
)
->
default_value
(
"xces"
),
readers_help
.
c_str
())
(
"output-format,o"
,
value
(
&
output_format
)
->
default_value
(
"ccl"
),
...
...
@@ -161,21 +171,29 @@ int main(int argc, char** argv)
boost
::
program_options
::
notify
(
vm
);
if
(
vm
.
count
(
"help"
))
{
std
::
cerr
<<
"Usage "
<<
argv
[
0
]
<<
" [OPTIONS] FILES
\n
"
<<
"Files ending with .xml are treated as corpora, otherwise
\n
"
<<
"as CCL files. Use - to read corpus from stdin (as with -I)"
;
usage
(
argv
[
0
]);
std
::
cout
<<
desc
<<
"
\n
"
;
return
1
;
}
foreach
(
const
std
::
string
&
f
,
files
)
{
if
(
boost
::
algorithm
::
ends_with
(
f
,
".xml"
))
{
if
(
f
==
"-"
)
{
corpus_stdin
=
true
;
}
else
if
(
boost
::
algorithm
::
ends_with
(
f
,
".xml"
))
{
corpora_files
.
push_back
(
f
);
}
else
{
ccl_files
.
push_back
(
f
);
}
}
// consider stdin only when no corpus files given
corpus_stdin
=
corpus_stdin
&&
corpora_files
.
empty
();
if
(
ccl_files
.
empty
()
||
(
corpora_files
.
empty
()
&&
!
corpus_stdin
))
{
usage
(
argv
[
0
]);
return
2
;
}
try
{
const
Corpus2
::
Tagset
&
tagset
=
Corpus2
::
get_named_tagset
(
tagset_load
);
MatchRunner
runner
(
tagset
);
...
...
@@ -188,9 +206,15 @@ int main(int argc, char** argv)
boost
::
shared_ptr
<
Corpus2
::
TokenWriter
>
writer
;
writer
.
reset
(
Corpus2
::
TokenWriter
::
create
(
output_format
,
std
::
cout
,
tagset
));
boost
::
shared_ptr
<
Corpus2
::
TokenReader
>
reader
;
reader
=
Corpus2
::
TokenReader
::
create_path_reader
(
input_format
,
tagset
,
corpora_files
[
0
]);
foreach
(
std
::
string
cf
,
corpora_files
)
{
reader
=
Corpus2
::
TokenReader
::
create_path_reader
(
input_format
,
tagset
,
cf
);
runner
.
apply_rules
(
reader
,
writer
);
}
if
(
corpus_stdin
)
{
reader
=
Corpus2
::
TokenReader
::
create_stream_reader
(
input_format
,
tagset
,
std
::
cin
);
runner
.
apply_rules
(
reader
,
writer
);
}
}
}
catch
(
PwrNlp
::
PwrNlpError
&
e
)
{
std
::
cerr
<<
e
.
info
()
<<
std
::
endl
;
return
2
;
...
...
This diff is collapsed.
Click to expand it.
wccl-apps/wccl-rules.cpp
+
21
−
6
View file @
b90d32e0
...
...
@@ -101,6 +101,14 @@ void apply_rules(boost::shared_ptr<Corpus2::TokenReader> reader,
}
}
void
usage
(
char
*
name
)
{
std
::
cerr
<<
"This program runs WCCL disambiguation rules.
\n
"
;
std
::
cerr
<<
"Usage "
<<
name
<<
" [OPTIONS] FILES
\n
"
<<
"Files ending with .xml are treated as corpora, otherwise
\n
"
<<
"as CCL files. Use - to read corpus from stdin (as with -I)
\n
"
;
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -130,6 +138,8 @@ int main(int argc, char** argv)
"CCL rule files
\n
"
)
(
"files,f"
,
value
(
&
files
),
"Files to load, looking at the extension to determine type
\n
"
)
(
"corpus-from-stdin,I"
,
value
(
&
corpus_stdin
)
->
zero_tokens
(),
"Read corpus from stdin"
)
(
"input-format,i"
,
value
(
&
input_format
)
->
default_value
(
"xces"
),
readers_help
.
c_str
())
(
"output-format,o"
,
value
(
&
output_format
)
->
default_value
(
"xces"
),
...
...
@@ -161,15 +171,15 @@ int main(int argc, char** argv)
boost
::
program_options
::
notify
(
vm
);
if
(
vm
.
count
(
"help"
))
{
std
::
cerr
<<
"Usage "
<<
argv
[
0
]
<<
" [OPTIONS] FILES
\n
"
<<
"Files ending with .xml are treated as corpora, otherwise
\n
"
<<
"as CCL files. Use - to read corpus from stdin (as with -I)"
;
usage
(
argv
[
0
]);
std
::
cout
<<
desc
<<
"
\n
"
;
return
1
;
}
foreach
(
const
std
::
string
&
f
,
files
)
{
if
(
boost
::
algorithm
::
ends_with
(
f
,
".xml"
))
{
if
(
f
==
"-"
)
{
corpus_stdin
=
true
;
}
else
if
(
boost
::
algorithm
::
ends_with
(
f
,
".xml"
))
{
corpora_files
.
push_back
(
f
);
}
else
{
ccl_files
.
push_back
(
f
);
...
...
@@ -179,6 +189,11 @@ int main(int argc, char** argv)
// consider stdin only when no corpus files given
corpus_stdin
=
corpus_stdin
&&
corpora_files
.
empty
();
if
(
ccl_files
.
empty
()
||
(
corpora_files
.
empty
()
&&
!
corpus_stdin
))
{
usage
(
argv
[
0
]);
return
2
;
}
try
{
const
Corpus2
::
Tagset
&
tagset
=
Corpus2
::
get_named_tagset
(
tagset_load
);
Wccl
::
Parser
parser
(
tagset
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment