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
95a3706c
Commit
95a3706c
authored
Apr 28, 2011
by
Adam Wardynski
Browse files
Options
Downloads
Patches
Plain Diff
Class to hold data about parsed wccl file.
parent
8e9878f3
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
libwccl/CMakeLists.txt
+1
-0
1 addition, 0 deletions
libwccl/CMakeLists.txt
libwccl/wcclfile.cpp
+57
-0
57 additions, 0 deletions
libwccl/wcclfile.cpp
libwccl/wcclfile.h
+356
-0
356 additions, 0 deletions
libwccl/wcclfile.h
with
414 additions
and
0 deletions
libwccl/CMakeLists.txt
+
1
−
0
View file @
95a3706c
...
...
@@ -96,6 +96,7 @@ SET(libwccl_STAT_SRC
values/tset.cpp
values/value.cpp
variables.cpp
wcclfile.cpp
)
SET
(
libwccl_STAT_SRC
${
libwccl_STAT_SRC
}
...
...
This diff is collapsed.
Click to expand it.
libwccl/wcclfile.cpp
0 → 100644
+
57
−
0
View file @
95a3706c
#include
<libwccl/wcclfile.h>
namespace
Wccl
{
FunctionalOpSequence
::
name_op_v_t
WcclFile
::
gen_all_op_pairs
()
{
FunctionalOpSequence
::
name_op_v_t
v
;
foreach
(
const
boost
::
shared_ptr
<
FunctionalOpSequence
>&
s
,
all_sections_
)
{
s
->
add_name_op_pairs_untyped
(
v
);
}
return
v
;
}
FunctionalOpSequence
::
name_op_v_c_t
WcclFile
::
gen_all_op_pairs
()
const
{
FunctionalOpSequence
::
name_op_v_c_t
v
;
foreach
(
const
boost
::
shared_ptr
<
FunctionalOpSequence
>&
s
,
all_sections_
)
{
s
->
add_name_op_pairs_untyped
(
v
);
}
return
v
;
}
boost
::
shared_ptr
<
TagRuleSequence
>
WcclFile
::
get_tag_rules_ptr
()
{
if
(
!
has_tag_rules
())
{
throw
WcclError
(
"There are no tag rules."
);
}
return
tag_rules_
;
}
boost
::
shared_ptr
<
const
TagRuleSequence
>
WcclFile
::
get_tag_rules_ptr
()
const
{
if
(
!
has_tag_rules
())
{
throw
WcclError
(
"There are no tag rules."
);
}
return
tag_rules_
;
}
std
::
ostream
&
WcclFile
::
write_to
(
std
::
ostream
&
os
)
const
{
foreach
(
const
boost
::
shared_ptr
<
FunctionalOpSequence
>&
s
,
all_sections_
)
{
os
<<
s
->
to_string
(
tagset_
)
<<
'\n'
;
}
if
(
has_tag_rules
())
{
os
<<
tag_rules_
->
to_string
(
tagset_
)
<<
'\n'
;
}
return
os
;
}
std
::
string
WcclFile
::
to_string
()
const
{
std
::
ostringstream
os
;
os
<<
*
this
;
return
os
.
str
();
}
}
/* end ns Wccl */
This diff is collapsed.
Click to expand it.
libwccl/wcclfile.h
0 → 100644
+
356
−
0
View file @
95a3706c
#ifndef LIBWCCL_WCCLFILE_H
#define LIBWCCL_WCCLFILE_H
#include
<libwccl/values/bool.h>
#include
<libwccl/values/match.h>
#include
<libwccl/values/position.h>
#include
<libwccl/values/strset.h>
#include
<libwccl/values/tset.h>
#include
<libwccl/wcclfileopsections.h>
#include
<libwccl/ops/tagrulesequence.h>
namespace
Wccl
{
class
WcclFile
:
boost
::
noncopyable
,
WcclFileOpSections
<
UntypedOpSequence
>
,
WcclFileOpSections
<
OpSequence
<
StrSet
>
>
,
WcclFileOpSections
<
OpSequence
<
TSet
>
>
,
WcclFileOpSections
<
OpSequence
<
Bool
>
>
,
WcclFileOpSections
<
OpSequence
<
Position
>
>
,
WcclFileOpSections
<
OpSequence
<
Match
>
>
{
public:
WcclFile
(
const
Corpus2
::
Tagset
tagset
);
const
std
::
vector
<
boost
::
shared_ptr
<
UntypedOpSequence
>
>&
untyped_sections
();
template
<
class
T
>
typename
const
std
::
vector
<
boost
::
shared_ptr
<
OpSequence
<
T
>
>
>&
sections
();
bool
has_untyped_section
(
const
std
::
string
&
name
)
const
;
template
<
class
T
>
bool
has_section
(
const
std
::
string
&
name
)
const
;
std
::
vector
<
std
::
string
>
untyped_section_names
()
const
;
template
<
class
T
>
std
::
vector
<
std
::
string
>
section_names
()
const
;
UntypedOpSequence
&
get_untyped_section
(
const
std
::
string
&
name
);
const
UntypedOpSequence
&
get_untyped_section
(
const
std
::
string
&
name
)
const
;
template
<
class
T
>
OpSequence
<
T
>&
get_section
(
const
std
::
string
&
name
);
template
<
class
T
>
const
OpSequence
<
T
>&
get_section
(
const
std
::
string
&
name
)
const
;
boost
::
shared_ptr
<
UntypedOpSequence
>
get_untyped_section_ptr
(
const
std
::
string
&
name
);
boost
::
shared_ptr
<
const
UntypedOpSequence
>
get_untyped_section_ptr
(
const
std
::
string
&
name
)
const
;
template
<
class
T
>
boost
::
shared_ptr
<
OpSequence
<
T
>
>
get_section_ptr
(
const
std
::
string
&
name
);
template
<
class
T
>
boost
::
shared_ptr
<
const
OpSequence
<
T
>
>
get_section_ptr
(
const
std
::
string
&
name
)
const
;
FunctionalOperator
&
get_untyped_op
(
const
std
::
string
&
name
,
size_t
idx
=
0
);
const
FunctionalOperator
&
get_untyped_op
(
const
std
::
string
&
name
,
size_t
idx
=
0
)
const
;
template
<
class
T
>
Operator
<
T
>&
get_op
(
const
std
::
string
&
name
,
size_t
idx
=
0
);
template
<
class
T
>
const
Operator
<
T
>&
get_op
(
const
std
::
string
&
name
,
size_t
idx
=
0
)
const
;
boost
::
shared_ptr
<
FunctionalOperator
>
get_untyped_op_ptr
(
const
std
::
string
&
name
,
size_t
idx
=
0
);
boost
::
shared_ptr
<
const
FunctionalOperator
>
get_untyped_op_ptr
(
const
std
::
string
&
name
,
size_t
idx
=
0
)
const
;
template
<
class
T
>
boost
::
shared_ptr
<
Operator
<
T
>
>
get_op_ptr
(
const
std
::
string
&
name
,
size_t
idx
=
0
);
template
<
class
T
>
boost
::
shared_ptr
<
const
Operator
<
T
>
>
get_op_ptr
(
const
std
::
string
&
name
,
size_t
idx
=
0
)
const
;
UntypedOpSequence
::
name_op_v_t
gen_name_untyped_op_pairs
();
UntypedOpSequence
::
name_op_v_c_t
gen_name_untyped_op_pairs
()
const
;
template
<
class
T
>
typename
OpSequence
<
T
>::
name_op_v_t
gen_name_op_pairs
();
template
<
class
T
>
typename
OpSequence
<
T
>::
name_op_v_c_t
gen_name_op_pairs
()
const
;
FunctionalOpSequence
::
name_op_v_t
gen_all_op_pairs
();
FunctionalOpSequence
::
name_op_v_c_t
gen_all_op_pairs
()
const
;
void
add_untyped_section
(
const
boost
::
shared_ptr
<
UntypedOpSequence
>&
section
);
void
add_untyped_section
(
const
boost
::
shared_ptr
<
const
UntypedOpSequence
>&
section
);
void
add_untyped_section
(
const
UntypedOpSequence
&
section
);
template
<
class
T
>
void
add_section
(
const
boost
::
shared_ptr
<
OpSequence
<
T
>
>&
section
);
template
<
class
T
>
void
add_section
(
const
boost
::
shared_ptr
<
const
OpSequence
<
T
>
>&
section
);
template
<
class
T
>
void
add_section
(
const
OpSequence
<
T
>&
section
);
bool
has_tag_rules
()
const
;
void
set_tag_rules
(
const
boost
::
shared_ptr
<
TagRuleSequence
>&
tag_rules
);
const
TagRuleSequence
&
get_tag_rules
()
const
;
boost
::
shared_ptr
<
TagRuleSequence
>
get_tag_rules_ptr
();
boost
::
shared_ptr
<
const
TagRuleSequence
>
get_tag_rules_ptr
()
const
;
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
ostream
,
const
WcclFile
&
wccl_file
);
std
::
string
to_string
()
const
;
const
Corpus2
::
Tagset
&
tagset
()
const
;
private:
std
::
ostream
&
write_to
(
std
::
ostream
&
ostream
)
const
;
std
::
vector
<
boost
::
shared_ptr
<
FunctionalOpSequence
>
>
all_sections_
;
boost
::
shared_ptr
<
TagRuleSequence
>
tag_rules_
;
const
Corpus2
::
Tagset
&
tagset_
;
};
}
/* end ns Wccl */
//
// Implementation
//
namespace
Wccl
{
inline
WcclFile
::
WcclFile
(
const
Corpus2
::
Tagset
tagset
)
:
tagset_
(
tagset
)
{
}
inline
const
std
::
vector
<
boost
::
shared_ptr
<
UntypedOpSequence
>
>&
WcclFile
::
untyped_sections
()
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
sections
();
}
template
<
class
T
>
inline
typename
const
std
::
vector
<
boost
::
shared_ptr
<
OpSequence
<
T
>
>
>&
WcclFile
::
sections
()
{
return
WcclFileOpSections
<
OpSequence
<
T
>
>::
sections
();
}
inline
bool
WcclFile
::
has_untyped_section
(
const
std
::
string
&
name
)
const
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
has_section
(
name
);
}
template
<
class
T
>
inline
bool
WcclFile
::
has_section
(
const
std
::
string
&
name
)
const
{
return
WcclFileOpSections
<
OpSequence
<
T
>
>::
has_section
(
name
);
}
inline
std
::
vector
<
std
::
string
>
WcclFile
::
untyped_section_names
()
const
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
section_names
();
}
template
<
class
T
>
inline
std
::
vector
<
std
::
string
>
WcclFile
::
section_names
()
const
{
return
WcclFileOpSections
<
OpSequence
<
T
>
>::
section_names
();
}
inline
UntypedOpSequence
&
WcclFile
::
get_untyped_section
(
const
std
::
string
&
name
)
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
get_section
(
name
);
}
inline
const
UntypedOpSequence
&
WcclFile
::
get_untyped_section
(
const
std
::
string
&
name
)
const
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
get_section
(
name
);
}
template
<
class
T
>
inline
typename
OpSequence
<
T
>&
WcclFile
::
get_section
(
const
std
::
string
&
name
)
{
return
WcclFileOpSections
<
OpSequence
<
T
>
>::
get_section
(
name
);
}
template
<
class
T
>
inline
typename
const
OpSequence
<
T
>&
WcclFile
::
get_section
(
const
std
::
string
&
name
)
const
{
return
WcclFileOpSections
<
OpSequence
<
T
>
>::
get_section
(
name
);
}
inline
boost
::
shared_ptr
<
UntypedOpSequence
>
WcclFile
::
get_untyped_section_ptr
(
const
std
::
string
&
name
)
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
get_section_ptr
(
name
);
}
inline
boost
::
shared_ptr
<
const
UntypedOpSequence
>
WcclFile
::
get_untyped_section_ptr
(
const
std
::
string
&
name
)
const
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
get_section_ptr
(
name
);
}
template
<
class
T
>
inline
typename
boost
::
shared_ptr
<
OpSequence
<
T
>
>
WcclFile
::
get_section_ptr
(
const
std
::
string
&
name
)
{
return
WcclFileOpSections
<
OpSequence
<
T
>
>::
get_section_ptr
(
name
);
}
template
<
class
T
>
inline
typename
boost
::
shared_ptr
<
const
OpSequence
<
T
>
>
WcclFile
::
get_section_ptr
(
const
std
::
string
&
name
)
const
{
return
WcclFileOpSections
<
OpSequence
<
T
>
>::
get_section_ptr
(
name
);
}
inline
FunctionalOperator
&
WcclFile
::
get_untyped_op
(
const
std
::
string
&
name
,
size_t
idx
)
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
get_op
(
name
,
idx
);
}
inline
const
FunctionalOperator
&
WcclFile
::
get_untyped_op
(
const
std
::
string
&
name
,
size_t
idx
)
const
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
get_op
(
name
,
idx
);
}
template
<
class
T
>
inline
typename
Operator
<
T
>&
WcclFile
::
get_op
(
const
std
::
string
&
name
,
size_t
idx
)
{
return
WcclFileOpSections
<
Operator
<
T
>
>::
get_op
(
name
,
idx
);
}
template
<
class
T
>
inline
typename
const
Operator
<
T
>&
WcclFile
::
get_op
(
const
std
::
string
&
name
,
size_t
idx
)
const
{
return
WcclFileOpSections
<
Operator
<
T
>
>::
get_op
(
name
,
idx
);
}
inline
boost
::
shared_ptr
<
FunctionalOperator
>
WcclFile
::
get_untyped_op_ptr
(
const
std
::
string
&
name
,
size_t
idx
)
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
get_op_ptr
(
name
,
idx
);
}
inline
boost
::
shared_ptr
<
const
FunctionalOperator
>
WcclFile
::
get_untyped_op_ptr
(
const
std
::
string
&
name
,
size_t
idx
)
const
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
get_op_ptr
(
name
,
idx
);
}
template
<
class
T
>
inline
boost
::
shared_ptr
<
Operator
<
T
>
>
WcclFile
::
get_op_ptr
(
const
std
::
string
&
name
,
size_t
idx
)
{
return
WcclFileOpSections
<
OpSequence
<
T
>
>::
get_op_ptr
(
name
,
idx
);
}
template
<
class
T
>
inline
boost
::
shared_ptr
<
const
Operator
<
T
>
>
WcclFile
::
get_op_ptr
(
const
std
::
string
&
name
,
size_t
idx
)
const
{
return
WcclFileOpSections
<
OpSequence
<
T
>
>::
get_op_ptr
(
name
,
idx
);
}
inline
UntypedOpSequence
::
name_op_v_t
WcclFile
::
gen_name_untyped_op_pairs
()
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
gen_name_op_pairs
();
}
inline
UntypedOpSequence
::
name_op_v_c_t
WcclFile
::
gen_name_untyped_op_pairs
()
const
{
return
WcclFileOpSections
<
UntypedOpSequence
>::
gen_name_op_pairs
();
}
template
<
class
T
>
inline
typename
OpSequence
<
T
>::
name_op_v_t
WcclFile
::
gen_name_op_pairs
()
{
return
WcclFileOpSections
<
OpSequence
<
T
>
>::
gen_name_op_pairs
();
}
template
<
class
T
>
inline
typename
OpSequence
<
T
>::
name_op_v_c_t
WcclFile
::
gen_name_op_pairs
()
const
{
return
WcclFileOpSections
<
OpSequence
<
T
>
>::
gen_name_op_pairs
();
}
inline
void
WcclFile
::
add_untyped_section
(
const
boost
::
shared_ptr
<
UntypedOpSequence
>&
section
)
{
WcclFileOpSections
<
UntypedOpSequence
>::
append
(
section
);
all_sections_
.
push_back
(
section
);
}
inline
void
WcclFile
::
add_untyped_section
(
const
boost
::
shared_ptr
<
const
UntypedOpSequence
>&
section
)
{
boost
::
shared_ptr
<
UntypedOpSequence
>
s
=
section
->
clone
();
add_untyped_section
(
s
);
}
inline
void
WcclFile
::
add_untyped_section
(
const
UntypedOpSequence
&
section
)
{
boost
::
shared_ptr
<
UntypedOpSequence
>
s
=
section
.
clone
();
add_untyped_section
(
s
);
}
template
<
class
T
>
inline
void
WcclFile
::
add_section
(
const
boost
::
shared_ptr
<
OpSequence
<
T
>
>&
section
)
{
WcclFileOpSections
<
OpSequence
<
T
>
>::
append
(
section
);
all_sections_
.
push_back
(
section
);
}
template
<
class
T
>
inline
void
WcclFile
::
add_section
(
const
boost
::
shared_ptr
<
const
OpSequence
<
T
>
>&
section
)
{
boost
::
shared_ptr
<
OpSequence
<
T
>
>
s
=
section
->
clone
();
add_section
(
s
);
}
template
<
class
T
>
inline
void
WcclFile
::
add_section
(
const
OpSequence
<
T
>&
section
)
{
boost
::
shared_ptr
<
OpSequence
<
T
>
>
s
=
section
.
clone
();
add_section
(
s
);
}
inline
bool
WcclFile
::
has_tag_rules
()
const
{
return
tag_rules_
;
}
inline
const
TagRuleSequence
&
WcclFile
::
get_tag_rules
()
const
{
return
*
get_tag_rules_ptr
();
}
inline
void
WcclFile
::
set_tag_rules
(
const
boost
::
shared_ptr
<
TagRuleSequence
>&
tag_rules
)
{
if
(
has_tag_rules
())
{
throw
WcclError
(
"Tag rules already added."
);
}
tag_rules_
=
tag_rules
;
}
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
ostream
,
const
WcclFile
&
wccl_file
)
{
return
wccl_file
.
write_to
(
ostream
);
}
inline
const
Corpus2
::
Tagset
&
WcclFile
::
tagset
()
const
{
return
tagset_
;
}
}
/* end ns Wccl */
#endif // LIBWCCL_WCCLFILE_H
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