Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus2
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
corpus2
Commits
1084636d
There was an error fetching the commit references. Please try again later.
Commit
1084636d
authored
13 years ago
by
ilor
Browse files
Options
Downloads
Patches
Plain Diff
RFT wrter latin2 flag
parent
bca77ee2
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libcorpus2/io/rft.cpp
+15
-2
15 additions, 2 deletions
libcorpus2/io/rft.cpp
libcorpus2/io/rft.h
+3
-0
3 additions, 0 deletions
libcorpus2/io/rft.h
with
18 additions
and
2 deletions
libcorpus2/io/rft.cpp
+
15
−
2
View file @
1084636d
...
@@ -25,7 +25,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
...
@@ -25,7 +25,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
namespace
Corpus2
{
namespace
Corpus2
{
bool
RftWriter
::
registered
=
TokenWriter
::
register_writer
<
RftWriter
>
(
bool
RftWriter
::
registered
=
TokenWriter
::
register_writer
<
RftWriter
>
(
"rft"
,
"mbt,nowarn,colon,alltags,opt"
);
"rft"
,
"mbt,nowarn,colon,alltags,opt
,latin2
"
);
RftWriter
::
RftWriter
(
std
::
ostream
&
os
,
const
Tagset
&
tagset
,
RftWriter
::
RftWriter
(
std
::
ostream
&
os
,
const
Tagset
&
tagset
,
const
string_range_vector
&
params
)
const
string_range_vector
&
params
)
...
@@ -46,6 +46,8 @@ RftWriter::RftWriter(std::ostream& os, const Tagset& tagset,
...
@@ -46,6 +46,8 @@ RftWriter::RftWriter(std::ostream& os, const Tagset& tagset,
opt_
=
true
;
opt_
=
true
;
}
else
if
(
p
==
"colon"
)
{
}
else
if
(
p
==
"colon"
)
{
colon_
=
true
;
colon_
=
true
;
}
else
if
(
p
==
"latin2"
)
{
encoding_
=
p
;
}
}
}
}
...
@@ -53,7 +55,18 @@ RftWriter::RftWriter(std::ostream& os, const Tagset& tagset,
...
@@ -53,7 +55,18 @@ RftWriter::RftWriter(std::ostream& os, const Tagset& tagset,
void
RftWriter
::
write_token
(
const
Token
&
t
)
void
RftWriter
::
write_token
(
const
Token
&
t
)
{
{
os
()
<<
t
.
orth_utf8
();
if
(
encoding_
.
empty
())
{
os
()
<<
t
.
orth_utf8
();
}
else
{
char
buf
[
256
];
int
len
=
t
.
orth
().
extract
(
0
,
t
.
orth
().
length
(),
buf
,
255
,
encoding_
.
c_str
());
if
(
len
<
256
)
{
os
()
<<
buf
;
}
else
{
std
::
cerr
<<
"Characetr encoding error in codepage rft output
\n
"
;
os
()
<<
"???"
;
}
}
if
(
t
.
lexemes
().
empty
())
{
if
(
t
.
lexemes
().
empty
())
{
if
(
warn_on_no_lexemes_
)
{
if
(
warn_on_no_lexemes_
)
{
std
::
cerr
<<
"No lexemes for token!"
;
std
::
cerr
<<
"No lexemes for token!"
;
...
...
This diff is collapsed.
Click to expand it.
libcorpus2/io/rft.h
+
3
−
0
View file @
1084636d
...
@@ -64,6 +64,9 @@ private:
...
@@ -64,6 +64,9 @@ private:
/// Dialect flag: output all lexemes, not just the preferred one
/// Dialect flag: output all lexemes, not just the preferred one
bool
alltags_
;
bool
alltags_
;
/// Dialect flag: use non-utf8 encoding
std
::
string
encoding_
;
};
};
class
RftReader
:
public
BufferedSentenceReader
class
RftReader
:
public
BufferedSentenceReader
...
...
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