Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus2
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
corpus2
Commits
457811ce
Commit
457811ce
authored
Apr 28, 2011
by
Paweł Kędzia
Browse files
Options
Downloads
Patches
Plain Diff
Corpus2::Annotation wrapper
parent
8d80327d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
swig/Makefile
+19
-6
19 additions, 6 deletions
swig/Makefile
swig/libcorpusannotationchannel.i
+84
-0
84 additions, 0 deletions
swig/libcorpusannotationchannel.i
with
103 additions
and
6 deletions
swig/Makefile
+
19
−
6
View file @
457811ce
...
@@ -21,7 +21,8 @@ CBIN=libcorpustag.o \
...
@@ -21,7 +21,8 @@ CBIN=libcorpustag.o \
libcorpuschunk.o
\
libcorpuschunk.o
\
libcorpustokenwriter.o
\
libcorpustokenwriter.o
\
libcorpustokenreader.o
\
libcorpustokenreader.o
\
libcorpusiob.o
libcorpusiob.o
\
libcorpusannotationchannel.o
CBINOUT
=
_boost_shared_ptr.so
\
CBINOUT
=
_boost_shared_ptr.so
\
_libcorpustag.so
\
_libcorpustag.so
\
...
@@ -33,7 +34,8 @@ CBINOUT=_boost_shared_ptr.so \
...
@@ -33,7 +34,8 @@ CBINOUT=_boost_shared_ptr.so \
_libcorpuschunk.so
\
_libcorpuschunk.so
\
_libcorpustokenwriter.so
\
_libcorpustokenwriter.so
\
_libcorpustokenreader.so
\
_libcorpustokenreader.so
\
_libcorpusiob.so
_libcorpusiob.so
\
_libcorpusannotationchannel.so
CWRAP
=
boost_shared_ptr_wrap.cxx
\
CWRAP
=
boost_shared_ptr_wrap.cxx
\
libcorpustag_wrap.cxx
\
libcorpustag_wrap.cxx
\
...
@@ -45,7 +47,8 @@ CWRAP=boost_shared_ptr_wrap.cxx \
...
@@ -45,7 +47,8 @@ CWRAP=boost_shared_ptr_wrap.cxx \
libcorpuschunk_wrap.cxx
\
libcorpuschunk_wrap.cxx
\
libcorpustokenwriter_wrap.cxx
\
libcorpustokenwriter_wrap.cxx
\
libcorpustokenreader_wrap.cxx
\
libcorpustokenreader_wrap.cxx
\
libcorpusiob_wrap.cxx
libcorpusiob_wrap.cxx
\
libcorpusannotationchannel_wrap.cxx
CWRAPBIN
=
boost_shared_ptr_wrap.o
\
CWRAPBIN
=
boost_shared_ptr_wrap.o
\
libcorpustag_wrap.o
\
libcorpustag_wrap.o
\
...
@@ -57,7 +60,8 @@ CWRAPBIN=boost_shared_ptr_wrap.o \
...
@@ -57,7 +60,8 @@ CWRAPBIN=boost_shared_ptr_wrap.o \
libcorpuschunk_wrap.o
\
libcorpuschunk_wrap.o
\
libcorpustokenwriter_wrap.o
\
libcorpustokenwriter_wrap.o
\
libcorpustokenreader_wrap.o
\
libcorpustokenreader_wrap.o
\
libcorpusiob_wrap.o
libcorpusiob_wrap.o
\
libcorpusannotationchannel_wrap.o
PYMODULES
=
boost_shared_ptr.py
\
PYMODULES
=
boost_shared_ptr.py
\
libcorpustag.py
\
libcorpustag.py
\
...
@@ -69,7 +73,8 @@ PYMODULES=boost_shared_ptr.py \
...
@@ -69,7 +73,8 @@ PYMODULES=boost_shared_ptr.py \
libcorpuschunk.py
\
libcorpuschunk.py
\
libcorpustokenwriter.py
\
libcorpustokenwriter.py
\
libcorpustokenreader.py
\
libcorpustokenreader.py
\
libcorpusiob.py
libcorpusiob.py
\
libcorpusannotationchannel.py
PYCBIN
=
boost_shared_ptr.pyc
\
PYCBIN
=
boost_shared_ptr.pyc
\
libcorpustag.pyc
\
libcorpustag.pyc
\
...
@@ -81,7 +86,8 @@ PYCBIN=boost_shared_ptr.pyc \
...
@@ -81,7 +86,8 @@ PYCBIN=boost_shared_ptr.pyc \
libcorpuschunk.pyc
\
libcorpuschunk.pyc
\
libcorpustokenwriter.pyc
\
libcorpustokenwriter.pyc
\
libcorpustokenreader.pyc
\
libcorpustokenreader.pyc
\
libcorpusiob.pyc
libcorpusiob.pyc
\
libcorpusannotationchannel.pyc
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
all
:
boost_shared_ptr.o $(CBIN)
all
:
boost_shared_ptr.o $(CBIN)
...
@@ -164,6 +170,13 @@ libcorpusiob.o:
...
@@ -164,6 +170,13 @@ libcorpusiob.o:
$(
CPP
)
-shared
libcorpusiob_wrap.o
\
$(
CPP
)
-shared
libcorpusiob_wrap.o
\
$(
PWRUTILBIN
)
$(
CORPUS2BIN
)
-o
_libcorpusiob.so
$(
PWRUTILBIN
)
$(
CORPUS2BIN
)
-o
_libcorpusiob.so
# AnnotationChannel
libcorpusannotationchannel.o
:
$(
SWIG
)
$(
SWIGOPTS_LANG
)
libcorpusannotationchannel.i
$(
CPP
)
-c
libcorpusannotationchannel_wrap.cxx
-I
$(
PYTHONDIR
)
$(
CPPFLAGS
)
$(
CPP
)
-shared
libcorpusannotationchannel_wrap.o
\
$(
PWRUTILBIN
)
$(
CORPUS2BIN
)
-o
_libcorpusannotationchannel.so
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
clean
:
clean
:
rm
-f
$(
CBIN
)
$(
CBINOUT
)
$(
CWRAP
)
$(
CWRAPBIN
)
$(
PYMODULES
)
$(
PYCBIN
)
rm
-f
$(
CBIN
)
$(
CBINOUT
)
$(
CWRAP
)
$(
CWRAPBIN
)
$(
PYMODULES
)
$(
PYCBIN
)
This diff is collapsed.
Click to expand it.
swig/libcorpusannotationchannel.i
0 → 100644
+
84
−
0
View file @
457811ce
#
ifndef
SWIG_LIBCORPUS2_ANNOTATIONCHANNEL_I
#
define
SWIG_LIBCORPUS2_ANNOTATIONCHANNEL_I
%
module
libcorpusannotationchannel
%
{
#include <libcorpus2/ann/channel.h>
%}
%
include
"
std_string.i
"
%
include
"
std_vector.i
"
%
include
"
libcorpusiob.i
"
%
template
(
IntVector
)
std
::
vector
<
int
>
;
%
template
(
IOBVector
)
std
::
vector
<
Corpus2
::
IOB
::
Enum
>
;
%
template
(
AnnotationVector
)
std
::
vector
<
Corpus2
::
Annotation
>
;
namespace
Corpus2
{
struct
Annotation
{
Annotation
()
:
indices
(),
head_index
(
-
1
)
{}
std
::
vector
<
int
>
indices
;
int
head_index
;
bool
empty
()
const
;
bool
sane
()
const
;
}
;
class
AnnotationChannel
{
public:
AnnotationChannel();
explicit AnnotationChannel(int size);
~AnnotationChannel();
/* --------------------------------------------------------------------- */
int size() const;
void resize(int size);
void make_iob_from_segments();
void make_segments_from_iob();
int renumber_segments();
int get_new_segment_index() const;
/* --------------------------------------------------------------------- */
enum AnnotationVectorMode {
O_DISJOINT_EXCLUSIVE = 0,
O_CONTINUOUS = 1,
O_INCLUSIVE = 2,
O_CONTINUOUS_INCLUSIVE = 3
};
std::vector<Annotation> make_annotation_vector(
AnnotationVectorMode mode = O_DISJOINT_EXCLUSIVE) const;
/* --------------------------------------------------------------------- */
std::vector<int>& segments();
const std::vector<int>& segments() const;
int get_segment_at(int idx) const;
void set_segment_at(int token_idx, int segment_idx);
/* --------------------------------------------------------------------- */
const std::vector<IOB::Enum>& iobs() const;
IOB::Enum get_iob_at(int idx);
/* --------------------------------------------------------------------- */
void set_iob_at(int idx, IOB::Enum iob);
bool is_head_at(int idx) const;
void set_head_at(int idx, bool v);
/* --------------------------------------------------------------------- */
std::string dump_iob() const;
std::string dump_segments() const;
std::string dump_heads() const;
std::string dump_alpha() const;
/* --------------------------------------------------------------------- */
void do_counts(int& annotations, int& disjoint, int& unannotated) const;
}
;
}
using
namespace
std
;
using
namespace
Corpus2
;
#
endif
/* SWIG_LIBCORPUS2_ANNOTATIONCHANNEL_I */
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