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
958384b8
Commit
958384b8
authored
Oct 30, 2011
by
Bartosz Broda
Browse files
Options
Downloads
Patches
Plain Diff
tagset checking
parent
65aa8487
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
libmwereader/mweparser.cpp
+4
-12
4 additions, 12 deletions
libmwereader/mweparser.cpp
libmwereader/mweparser.h
+2
-0
2 additions, 0 deletions
libmwereader/mweparser.h
libmwereader/mwereader.cpp
+3
-0
3 additions, 0 deletions
libmwereader/mwereader.cpp
with
9 additions
and
12 deletions
libmwereader/mweparser.cpp
+
4
−
12
View file @
958384b8
...
@@ -51,9 +51,7 @@ namespace Corpus2 {
...
@@ -51,9 +51,7 @@ namespace Corpus2 {
if
(
search
!=
where
.
end
())
if
(
search
!=
where
.
end
())
return
search
->
second
;
return
search
->
second
;
//std::cout << " dddddddddddddd "<< cond << std::endl;
BoolOpPtr
op
=
parser_
.
parseBoolOperator
(
cond
);
BoolOpPtr
op
=
parser_
.
parseBoolOperator
(
cond
);
//std::cout << " dddddddddddddd $$$$" << cond << std::endl;
where
[
cond
]
=
op
;
where
[
cond
]
=
op
;
return
op
;
return
op
;
...
@@ -75,25 +73,19 @@ namespace Corpus2 {
...
@@ -75,25 +73,19 @@ namespace Corpus2 {
{
{
MWEBuilder
::
BoolOpPtr
main
=
mwe_builder_
->
get_mwe_condition
(
MWEBuilder
::
BoolOpPtr
main
=
mwe_builder_
->
get_mwe_condition
(
wccl_operator_
);
wccl_operator_
);
//std::cout << " kupa head" << std::endl;
MWEBuilder
::
BoolOpPtr
head
=
mwe_builder_
->
get_head_condition
(
MWEBuilder
::
BoolOpPtr
head
=
mwe_builder_
->
get_head_condition
(
head_cond_
);
head_cond_
);
//std::cout << " kupa " << std::endl;
if
(
group_type_
==
"fix"
){
// group_name_ -> lower case
if
(
group_type_
==
"fix"
){
// group_name_ -> lower case
//std::cout << " kupa fix" << std::endl;
mwe_index_
.
add_lexicalunit
(
LexicalUnit
::
Ptr
(
new
FixedLU
(
mwe_base_
,
main
,
head
,
mwe_index_
.
add_lexicalunit
(
LexicalUnit
::
Ptr
(
new
FixedLU
(
mwe_base_
,
main
,
head
,
variables_
)));
variables_
)));
}
else
if
(
group_type_
==
"flex"
){
}
else
if
(
group_type_
==
"flex"
){
//std::cout << " kupa flex" << std::endl;
mwe_index_
.
add_lexicalunit
(
LexicalUnit
::
Ptr
(
new
FlexLU
(
mwe_base_
,
main
,
head
,
mwe_index_
.
add_lexicalunit
(
LexicalUnit
::
Ptr
(
new
FlexLU
(
mwe_base_
,
main
,
head
,
variables_
)));
variables_
)));
}
else
{
}
else
{
throw
Wccl
::
WcclError
(
"Unknown type of lexical unit:"
throw
Wccl
::
WcclError
(
"Unknown type of lexical unit:"
+
group_type_
);
+
group_type_
);
}
}
//std::cout << " kupa clear" << std::endl;
variables_
.
clear
();
variables_
.
clear
();
//std::cout << "po kupie " << std::endl;
}
}
std
::
string
MWEParser
::
get_attribute
(
const
AttributeList
&
attributes
,
std
::
string
MWEParser
::
get_attribute
(
const
AttributeList
&
attributes
,
...
@@ -128,7 +120,6 @@ namespace Corpus2 {
...
@@ -128,7 +120,6 @@ namespace Corpus2 {
void
MWEParser
::
on_start_element
(
const
Glib
::
ustring
&
name
,
void
MWEParser
::
on_start_element
(
const
Glib
::
ustring
&
name
,
const
AttributeList
&
attributes
)
const
AttributeList
&
attributes
)
{
{
//std::cout << state_ << ": " << name << std::endl;
if
(
state_
==
NONE
&&
name
==
"units_description"
){
if
(
state_
==
NONE
&&
name
==
"units_description"
){
tagset_
=
get_attribute
(
attributes
,
"tagset"
);
tagset_
=
get_attribute
(
attributes
,
"tagset"
);
mwe_builder_
=
boost
::
shared_ptr
<
MWEBuilder
>
(
new
MWEBuilder
(
Corpus2
::
get_named_tagset
(
tagset_
)));
mwe_builder_
=
boost
::
shared_ptr
<
MWEBuilder
>
(
new
MWEBuilder
(
Corpus2
::
get_named_tagset
(
tagset_
)));
...
@@ -160,8 +151,6 @@ namespace Corpus2 {
...
@@ -160,8 +151,6 @@ namespace Corpus2 {
void
MWEParser
::
on_end_element
(
const
Glib
::
ustring
&
name
)
void
MWEParser
::
on_end_element
(
const
Glib
::
ustring
&
name
)
{
{
//std::cout << "/" << state_ << ": " << name << std::endl;
if
(
name
==
"units_description"
){
if
(
name
==
"units_description"
){
state_
=
NONE
;
state_
=
NONE
;
}
else
if
(
state_
==
CONDITION
&&
name
==
"condition"
){
}
else
if
(
state_
==
CONDITION
&&
name
==
"condition"
){
...
@@ -207,8 +196,11 @@ namespace Corpus2 {
...
@@ -207,8 +196,11 @@ namespace Corpus2 {
boost
::
algorithm
::
trim
(
str
);
boost
::
algorithm
::
trim
(
str
);
grab_characters_
=
false
;
grab_characters_
=
false
;
return
str
;
return
str
;
}
//std::pair<wcclptr, wcclptr, map<string,string>, string, type>
Corpus2
::
Tagset
MWEParser
::
get_tagset
()
const
{
return
Corpus2
::
get_named_tagset
(
tagset_
);
}
}
}
// ns Corpus2
}
// ns Corpus2
This diff is collapsed.
Click to expand it.
libmwereader/mweparser.h
+
2
−
0
View file @
958384b8
...
@@ -60,6 +60,8 @@ public:
...
@@ -60,6 +60,8 @@ public:
MWEParser
(
MWEIndex
&
index
);
MWEParser
(
MWEIndex
&
index
);
~
MWEParser
();
~
MWEParser
();
Corpus2
::
Tagset
get_tagset
()
const
;
protected:
protected:
void
create_mwe
();
void
create_mwe
();
typedef
std
::
map
<
std
::
string
,
std
::
string
>
str_map
;
typedef
std
::
map
<
std
::
string
,
std
::
string
>
str_map
;
...
...
This diff is collapsed.
Click to expand it.
libmwereader/mwereader.cpp
+
3
−
0
View file @
958384b8
...
@@ -216,6 +216,9 @@ bool MWEReader::registered = TokenReader::register_path_reader<MWEReader>(
...
@@ -216,6 +216,9 @@ bool MWEReader::registered = TokenReader::register_path_reader<MWEReader>(
parser
.
parse_file
(
filename
);
parser
.
parse_file
(
filename
);
mwes_counter
++
;
mwes_counter
++
;
if
(
parser
.
get_tagset
().
name
()
!=
tagset
().
name
())
throw
std
::
runtime_error
(
"Tagset in mwe file does not match reader 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