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
cee3b953
There was an error fetching the commit references. Please try again later.
Commit
cee3b953
authored
13 years ago
by
Bartosz Broda
Browse files
Options
Downloads
Patches
Plain Diff
add preliminary impl. of IsHere for fixed LU
parent
f02e80f2
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libmwereader/mwe.cpp
+42
-9
42 additions, 9 deletions
libmwereader/mwe.cpp
libmwereader/mwe.h
+14
-0
14 additions, 0 deletions
libmwereader/mwe.h
libmwereader/mweparser.cpp
+3
-5
3 additions, 5 deletions
libmwereader/mweparser.cpp
with
59 additions
and
14 deletions
libmwereader/mwe.cpp
+
42
−
9
View file @
cee3b953
#include
"mwe.h"
#include
<boost/algorithm/string.hpp>
namespace
Corpus2
{
LexicalUnit
::
LexicalUnit
(
const
std
::
string
&
base
,
boost
::
shared_ptr
<
Wccl
::
Operator
<
Wccl
::
Bool
>
>
condition
,
boost
::
shared_ptr
<
Wccl
::
Operator
<
Wccl
::
Bool
>
>
head_cond
,
std
::
map
<
std
::
string
,
std
::
string
>
variables
)
:
condition_
(
condition
),
head_cond_
(
head_cond
),
variables_
(
variables
),
base_
(
base
)
{
LexicalUnit
::
LexicalUnit
(
const
std
::
string
&
base
,
boost
::
shared_ptr
<
Wccl
::
Operator
<
Wccl
::
Bool
>
>
condition
,
boost
::
shared_ptr
<
Wccl
::
Operator
<
Wccl
::
Bool
>
>
head_cond
,
std
::
map
<
std
::
string
,
std
::
string
>
variables
)
:
condition_
(
condition
),
head_cond_
(
head_cond
),
variables_
(
variables
),
base_
(
base
),
nowhere_
(
Wccl
::
Position
())
{
// noop
}
FixedLU
::
FixedLU
(
const
std
::
string
&
base
,
boost
::
shared_ptr
<
Wccl
::
Operator
<
Wccl
::
Bool
>
>
condition
,
boost
::
shared_ptr
<
Wccl
::
Operator
<
Wccl
::
Bool
>
>
head_cond
,
std
::
map
<
std
::
string
,
std
::
string
>
variables
)
:
LexicalUnit
(
base
,
condition
,
head_cond
,
variables
)
{
}
bool
FixedLU
::
IsHere
(
const
Wccl
::
SentenceContext
&
sc
,
std
::
set
<
size_t
>
&
out_position
)
{
boost
::
shared_ptr
<
const
Wccl
::
Bool
>
pResult
=
condition_
->
apply
(
sc
);
if
(
pResult
->
get_value
()
==
false
)
return
false
;
foreach
(
const
std
::
string
&
varname
,
condition_
->
valid_variable_names
()){
if
(
boost
::
algorithm
::
starts_with
(
varname
,
"Pos"
)){
Wccl
::
Position
pos
=
condition_
->
get
<
Wccl
::
Position
>
(
varname
);
if
(
pos
.
equals
(
nowhere_
)){
std
::
string
errmsg
(
"Position for found MWE cannot be zero."
);
errmsg
+=
" Offending unit: "
+
base_
;
throw
Wccl
::
WcclError
(
errmsg
);
}
out_position
.
insert
(
sc
.
get_abs_position
(
pos
)
);
}
}
return
true
;
}
}
//ns Corpus2
This diff is collapsed.
Click to expand it.
libmwereader/mwe.h
+
14
−
0
View file @
cee3b953
...
...
@@ -16,15 +16,29 @@ public:
boost
::
shared_ptr
<
Wccl
::
Operator
<
Wccl
::
Bool
>
>
head_cond
,
std
::
map
<
std
::
string
,
std
::
string
>
variables
);
virtual
bool
IsHere
(
const
Wccl
::
SentenceContext
&
sc
,
std
::
set
<
size_t
>
&
out_position
)
=
0
;
protected:
boost
::
shared_ptr
<
Wccl
::
Operator
<
Wccl
::
Bool
>
>
condition_
;
boost
::
shared_ptr
<
Wccl
::
Operator
<
Wccl
::
Bool
>
>
head_cond_
;
std
::
map
<
std
::
string
,
std
::
string
>
variables_
;
std
::
string
base_
;
const
Wccl
::
Position
nowhere_
;
};
class
FixedLU
:
public
LexicalUnit
{
public:
FixedLU
(
const
std
::
string
&
base
,
boost
::
shared_ptr
<
Wccl
::
Operator
<
Wccl
::
Bool
>
>
condition
,
boost
::
shared_ptr
<
Wccl
::
Operator
<
Wccl
::
Bool
>
>
head_cond
,
std
::
map
<
std
::
string
,
std
::
string
>
variables
);
virtual
bool
IsHere
(
const
Wccl
::
SentenceContext
&
sc
,
std
::
set
<
size_t
>
&
out_position
);
};
...
...
This diff is collapsed.
Click to expand it.
libmwereader/mweparser.cpp
+
3
−
5
View file @
cee3b953
...
...
@@ -60,11 +60,9 @@ namespace Corpus2 {
MWEBuilder
::
BoolOpPtr
head
=
mwe_builder_
->
get_head_condition
(
head_cond_
);
//const Corpus2::Tagset& tagset = Corpus2::get_named_tagset(tagset_);
foreach
(
const
std
::
string
&
varname
,
main
->
valid_variable_names
())
if
(
boost
::
algorithm
::
starts_with
(
varname
,
"Pos"
))
std
::
cout
<<
"Pozycja: "
<<
varname
<<
std
::
endl
;
//foreach(const std::string&varname, main->valid_variable_names())
//if(boost::algorithm::starts_with(varname, "Pos"))
//std::cout << "Pozycja: " << varname << std::endl;
}
...
...
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