Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WCCL
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
WCCL
Commits
b1e4d384
There was an error fetching the commit references. Please try again later.
Commit
b1e4d384
authored
13 years ago
by
ilor
Browse files
Options
Downloads
Patches
Plain Diff
add wccl path setting to wccl-rules
parent
b7e8f7b3
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wccl-apps/wccl-rules.cpp
+13
-2
13 additions, 2 deletions
wccl-apps/wccl-rules.cpp
with
13 additions
and
2 deletions
wccl-apps/wccl-rules.cpp
+
13
−
2
View file @
b1e4d384
...
@@ -27,7 +27,7 @@ class RuleRunner
...
@@ -27,7 +27,7 @@ class RuleRunner
{
{
public:
public:
RuleRunner
(
const
Corpus2
::
Tagset
&
tagset
)
RuleRunner
(
const
Corpus2
::
Tagset
&
tagset
)
:
tagset_
(
tagset
),
parser_
(
tagset_
),
progress_
(
false
)
:
tagset_
(
tagset
),
parser_
(
tagset_
),
progress_
(
false
)
,
search_path_
(
"."
)
,
tag_rule_iterations_
(
0
),
total_match_rules_
(
0
),
total_tag_rules_
(
0
)
,
tag_rule_iterations_
(
0
),
total_match_rules_
(
0
),
total_tag_rules_
(
0
)
{
{
}
}
...
@@ -65,12 +65,17 @@ public:
...
@@ -65,12 +65,17 @@ public:
return
total_tag_rules_
;
return
total_tag_rules_
;
}
}
void
set_search_path
(
const
std
::
string
&
path
)
{
search_path_
=
path
;
}
private
:
private
:
const
Corpus2
::
Tagset
&
tagset_
;
const
Corpus2
::
Tagset
&
tagset_
;
Wccl
::
Parser
parser_
;
Wccl
::
Parser
parser_
;
std
::
vector
<
std
::
string
>
file_names_
;
std
::
vector
<
std
::
string
>
file_names_
;
std
::
vector
<
boost
::
shared_ptr
<
Wccl
::
WcclFile
>
>
parsed_files_
;
std
::
vector
<
boost
::
shared_ptr
<
Wccl
::
WcclFile
>
>
parsed_files_
;
bool
progress_
;
bool
progress_
;
std
::
string
search_path_
;
int
tag_rule_iterations_
;
int
tag_rule_iterations_
;
size_t
total_match_rules_
,
total_tag_rules_
;
size_t
total_match_rules_
,
total_tag_rules_
;
};
};
...
@@ -83,7 +88,7 @@ std::pair<int,int> RuleRunner::load_more_rules(const std::string& filename)
...
@@ -83,7 +88,7 @@ std::pair<int,int> RuleRunner::load_more_rules(const std::string& filename)
if
(
!
is
.
good
())
{
if
(
!
is
.
good
())
{
throw
Wccl
::
FileNotFound
(
filename
,
""
,
__FUNCTION__
);
throw
Wccl
::
FileNotFound
(
filename
,
""
,
__FUNCTION__
);
}
}
parsed_file
=
parser_
.
parseWcclFile
(
is
,
"."
);
parsed_file
=
parser_
.
parseWcclFile
(
is
,
search_path_
);
if
(
parsed_file
)
{
if
(
parsed_file
)
{
boost
::
filesystem
::
path
p
(
filename
);
boost
::
filesystem
::
path
p
(
filename
);
file_names_
.
push_back
(
p
.
stem
());
file_names_
.
push_back
(
p
.
stem
());
...
@@ -152,6 +157,7 @@ int main(int argc, char** argv)
...
@@ -152,6 +157,7 @@ int main(int argc, char** argv)
std
::
string
tagset_load
=
"kipi"
;
std
::
string
tagset_load
=
"kipi"
;
std
::
string
input_format
;
std
::
string
input_format
;
std
::
string
output_format
;
std
::
string
output_format
;
std
::
string
search_path
;
bool
progress
=
false
;
bool
progress
=
false
;
options
opts
;
options
opts
;
opts
.
first
=
false
;
opts
.
first
=
false
;
...
@@ -174,6 +180,8 @@ int main(int argc, char** argv)
...
@@ -174,6 +180,8 @@ int main(int argc, char** argv)
"CCL rule files
\n
"
)
"CCL rule files
\n
"
)
(
"files,f"
,
value
(
&
files
),
(
"files,f"
,
value
(
&
files
),
"Files to load, looking at the extension to determine type
\n
"
)
"Files to load, looking at the extension to determine type
\n
"
)
(
"search-path,P"
,
value
(
&
search_path
),
"WCCL resources (lexicons) search path"
)
(
"corpus-from-stdin,I"
,
value
(
&
corpus_stdin
)
->
zero_tokens
(),
(
"corpus-from-stdin,I"
,
value
(
&
corpus_stdin
)
->
zero_tokens
(),
"Read corpus from stdin (requires that no corpora filenames are passed)"
)
"Read corpus from stdin (requires that no corpora filenames are passed)"
)
(
"input-format,i"
,
value
(
&
input_format
)
->
default_value
(
"xces"
),
(
"input-format,i"
,
value
(
&
input_format
)
->
default_value
(
"xces"
),
...
@@ -235,6 +243,9 @@ int main(int argc, char** argv)
...
@@ -235,6 +243,9 @@ int main(int argc, char** argv)
runner
.
set_tag_rule_iterations
(
vm
[
"until-done-iterations"
].
as
<
int
>
());
runner
.
set_tag_rule_iterations
(
vm
[
"until-done-iterations"
].
as
<
int
>
());
}
}
runner
.
use_progress
(
progress
);
runner
.
use_progress
(
progress
);
if
(
!
search_path
.
empty
())
{
runner
.
set_search_path
(
search_path
);
}
foreach
(
const
std
::
string
&
file
,
ccl_files
)
{
foreach
(
const
std
::
string
&
file
,
ccl_files
)
{
std
::
pair
<
int
,
int
>
res
=
runner
.
load_more_rules
(
file
);
std
::
pair
<
int
,
int
>
res
=
runner
.
load_more_rules
(
file
);
if
(
res
.
first
==
0
&&
res
.
second
==
0
)
{
if
(
res
.
first
==
0
&&
res
.
second
==
0
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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