Difference between revisions of "Voikkospell"
Line 109: | Line 109: | ||
====Reserved Characters==== |
====Reserved Characters==== |
||
<code> |
<code>\</code>, <code>^</code>, <code>/</code>, <code><</code>, <code>></code>, and <code>$</code> are reserved. |
||
===== |
=====\===== |
||
<pre> |
<pre> |
||
$ echo -n '\' | voikkospell --apertium-stream |
$ echo -n '\' | voikkospell --apertium-stream |
||
Line 123: | Line 123: | ||
</pre> |
</pre> |
||
===== |
=====^===== |
||
<pre> |
<pre> |
||
$ echo -n '^' | voikkospell --apertium-stream |
$ echo -n '^' | voikkospell --apertium-stream |
||
Line 135: | Line 135: | ||
</pre> |
</pre> |
||
===== |
=====/===== |
||
<pre> |
<pre> |
||
$ echo -n '/' | voikkospell --apertium-stream |
$ echo -n '/' | voikkospell --apertium-stream |
||
Line 147: | Line 147: | ||
</pre> |
</pre> |
||
===== |
=====<===== |
||
<pre> |
<pre> |
||
$ echo -n '<' | voikkospell --apertium-stream |
$ echo -n '<' | voikkospell --apertium-stream |
||
Line 159: | Line 159: | ||
</pre> |
</pre> |
||
===== |
=====>===== |
||
<pre> |
<pre> |
||
$ echo -n '>' | voikkospell --apertium-stream |
$ echo -n '>' | voikkospell --apertium-stream |
||
Line 171: | Line 171: | ||
</pre> |
</pre> |
||
===== |
=====$===== |
||
<pre> |
<pre> |
||
$ echo -n '$' | voikkospell --apertium-stream |
$ echo -n '$' | voikkospell --apertium-stream |
||
Line 183: | Line 183: | ||
</pre> |
</pre> |
||
===== |
=====Escape===== |
||
To avoid these errors, escape |
To avoid these errors, escape all reserved characters: |
||
======Escape====== |
|||
<pre> |
<pre> |
||
$ echo -n '\\\^\/\<\>\$' | voikkospell --apertium-stream |
$ echo -n '\\\^\/\<\>\$' | voikkospell --apertium-stream |
||
</pre> |
</pre> |
||
====== |
======Superblank====== |
||
One can also make all reserved characters except <code>\</code> part of superblanks: |
|||
<pre> |
<pre> |
||
$ echo -n '[^/<>$]' | voikkospell --apertium-stream |
$ echo -n '[^/<>$]' | voikkospell --apertium-stream |
||
</pre> |
</pre> |
||
<code> |
<code>\</code> must be escaped: |
||
<pre> |
<pre> |
Revision as of 13:21, 15 December 2015
Contents
Installation
m5w/corevoikko, a fork of corevoikko, supports apertium stream format.
To clone it, execute the following command:
git clone https://github.com/m5w/corevoikko.git corevoikko
First, install libvoikko's dependencies. Next, execute the following commands:
cd corevoikko/libvoikko ./configure make sudo make install
If you do not have root privileges or would like to specify where to install libvoikko, execute the following instead: (Otherwise, you are finished with installation.)
cd corevoikko/libvoikko PREFIX="$HOME/install/corevoikko" # e.g. ./configure --prefix="$PREFIX" make make install
Finally, add your "$PREFIX"
to your "$PATH"
by appending the following lines to your .profile
:
PREFIX="$HOME/install/corevoikko" # e.g. if [ -d "$PREFIX" ]; then export PATH="$PREFIX/bin:$PATH" fi
Using voikkospell with apertium Stream Format
Invoke voikkospell with --apertium-stream
.
Unlike in normal voikkospell usage, each word does not need to be on its own line.
Examples
Trailing Newline
$ echo '' | voikkospell --apertium-stream terminate called after throwing an instance of 'Apertium::ApertiumStream::Unexpe ctedReservedCharacter' what(): 1:1: unexpected '\n', '\n' expected to follow '[' ^ Aborted
For this reason, when piping text directly to voikkospell --apertium-stream
, use echo -n
. It is not necessary to do this when piping through tools such as apertium-deshtml
, which encapsulate all newlines in superblanks.
One could also escape the newline:
$ echo '\' | voikkospell --apertium-stream
Unanalysed Word
$ echo -n '^a/*a$' | voikkospell --apertium-stream W: a
Analysed Words
One Tag
$ echo -n '^b/b<A>$' | voikkospell --apertium-stream W: b
More Than One Tag
$ echo -n '^c/c<B><C>$' | voikkospell --apertium-stream W: c
Ambiguous Word
$ echo -n '^d/d<D>/d<E><F>$' | voikkospell --apertium-stream W: d
Multiwords
One Word with Inner Inflection
$ echo -n '^e f/e<G># f/e<H><I># f$' | voikkospell --apertium-stream W: e f
More Than One Word
Without Inner Inflection
$ echo -n 'gh/g<J>+h<K><L>/g<M>+h<N>$' | voikkospell --apertium-stream W: gh
With Inner Inflection
$ echo -n '^i jk/i<O># j+k<P><Q>/i<R># j+k<S>$ ^lm n/l<T>+m<U># n/l<V>+m<W># n$' | \ voikkospell --apertium-stream W: i jk W: lm n
Reserved Characters
\
, ^
, /
, <
, >
, and $
are reserved.
\
$ echo -n '\' | voikkospell --apertium-stream terminate called after throwing an instance of 'Apertium::ApertiumStream::Unexpe ctedEndOfFile' what(): 1:1: unexpected end-of-file following '\', end-of-file expected to fo llow ']' or '$' \ ^ Aborted
^
$ echo -n '^' | voikkospell --apertium-stream terminate called after throwing an instance of 'Apertium::ApertiumStream::Unexpe ctedEndOfFile' what(): 1:2: unexpected end-of-file following '^', end-of-file expected to fo llow ']' or '$' ^ ^ Aborted
/
$ echo -n '/' | voikkospell --apertium-stream terminate called after throwing an instance of 'Apertium::ApertiumStream::Unexpe ctedReservedCharacter' what(): 1:1: unexpected '/', '/' expected to follow '[', to follow '>' immedi ately, or to follow '^' or '#' not immediately / ^ Aborted
<
$ echo -n '<' | voikkospell --apertium-stream terminate called after throwing an instance of 'Apertium::ApertiumStream::Unexpe ctedReservedCharacter' what(): 1:1: unexpected '<', '<' expected to follow '[', to follow '>' immedi ately, or to follow '/' or '+' not immediately < ^ Aborted
>
$ echo -n '>' | voikkospell --apertium-stream terminate called after throwing an instance of 'Apertium::ApertiumStream::Unexpe ctedReservedCharacter' what(): 1:1: unexpected '>', '>' expected to follow '[' or to follow '<' not immediately > ^ Aborted
$
$ echo -n '$' | voikkospell --apertium-stream terminate called after throwing an instance of 'Apertium::ApertiumStream::Unexpe ctedReservedCharacter' what(): 1:1: unexpected '$', '$' expected to follow '[', to follow '>' immedi ately, or to follow '*' or '#' not immediately $ ^ Aborted
Escape
To avoid these errors, escape all reserved characters:
$ echo -n '\\\^\/\<\>\$' | voikkospell --apertium-stream
Superblank
One can also make all reserved characters except \
part of superblanks:
$ echo -n '[^/<>$]' | voikkospell --apertium-stream
\
must be escaped:
$ echo -n '[\]' | voikkospell --apertium-stream terminate called after throwing an instance of 'Apertium::ApertiumStream::Unexpe ctedEndOfFile' what(): 1:3: unexpected end-of-file following '[', end-of-file expected to fo llow ']' or '$' [\] ^ Aborted