Lexeme | 30 | *Roots | 31 | *Usages for roots | 32 | *
---|---|---|
kitap+Noun | 35 | *kitap, kitab | 36 | *kitapta, kitaba | 37 | *
omuz+Noun | 40 | *omuz, omz | 41 | *omuzlarda, omzunu | 42 | *
hak | 45 | *hak, hakk | 46 | *hak davası, hakkımı arıyorum | 47 | *
kek+Noun | 50 | *kek* | 51 | *keki | 52 | *
* Please note that there is no keg or keğ55 | * 56 | * In other words, a root is a text derived from a lexeme with one of the possible phonetic rules 57 | * respecting the phonetic attributes and lexeme attributes of the lexeme and the lemma root sequence. 58 | */ 59 | public interface Root { 60 | public TurkishSequence getSequence(); 61 | 62 | public Lexeme getLexeme(); 63 | 64 | public Set
ConditionalFreeTransitionSuffix
es are not put in the string representation of a parse result.
26 | */
27 | public class ConditionalFreeTransitionSuffix extends Suffix {
28 |
29 | public ConditionalFreeTransitionSuffix(String name) {
30 | super(name, null, null, false);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/core/src/main/java/org/trnltk/model/suffix/FreeTransitionSuffix.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Ali Ok (aliokATapacheDOTorg)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.trnltk.model.suffix;
18 |
19 | /**
20 | * A shorthand for having a {@link Suffix} that has a default {@link SuffixForm} that has no conditions and has a
21 | * suffix form of empty string.
22 | *
23 | * That means, it is an epsilon transition in the FSM.
24 | *
25 | * FreeTransitionSuffix
es are not put in the string representation of a parse result.
26 | */
27 | public class FreeTransitionSuffix extends Suffix {
28 |
29 | public FreeTransitionSuffix(String name) {
30 | super(name, null, null, false);
31 | this.addSuffixForm("");
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/core/src/main/java/org/trnltk/model/suffix/SuffixGroup.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Ali Ok (aliokATapacheDOTorg)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.trnltk.model.suffix;
18 |
19 | import java.util.LinkedHashSet;
20 | import java.util.Set;
21 |
22 | /**
23 | * Groups multiple {@link Suffix}es.
24 | *
25 | * This is useful when parsing (e.g. 2 suffixes from the same group cannot exist in a inflection group) and also
26 | * in graphical representation (e.g. suffixes from the same group are drawn with the same color).
27 | */
28 | public class SuffixGroup {
29 | private final String name;
30 | private final SetZeroTransitionSuffix
es are put in the string representation of a parse result.
28 | */
29 | public class ZeroTransitionSuffix extends Suffix {
30 | private static final String PRETTY_NAME = "Zero";
31 |
32 | public ZeroTransitionSuffix(String name) {
33 | super(name, null, PRETTY_NAME, false);
34 | this.addSuffixForm("");
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/core/src/main/java/org/trnltk/morphology/contextless/parser/ContextlessMorphologicParserListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Ali Ok (aliokATapacheDOTorg)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.trnltk.morphology.contextless.parser;
18 |
19 | import org.trnltk.model.morpheme.MorphemeContainer;
20 |
21 | /**
22 | * Contract for a listener that is notified when something happens on {@link MorphemeContainer}s that are being traversed.
23 | */
24 | public interface ContextlessMorphologicParserListener {
25 |
26 | public void onMorphemeContainerInvalidated(MorphemeContainer morphemeContainer);
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/core/src/main/java/org/trnltk/morphology/contextless/parser/MorphologicParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Ali Ok (aliokATapacheDOTorg)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.trnltk.morphology.contextless.parser;
18 |
19 | import org.trnltk.model.morpheme.MorphemeContainer;
20 | import org.trnltk.model.letter.TurkishSequence;
21 |
22 | import java.util.List;
23 |
24 | /**
25 | * The contract for the morphologic parser implementations.
26 | *
27 | * A morphologic parser takes the input and fragments it into smaller parts, namely morphemes.
28 | * These smaller parts are root, suffixes, etc.
29 | * Morphemes are contained within a {@link MorphemeContainer}.
30 | */
31 | public interface MorphologicParser {
32 |
33 | /**
34 | * Parses the given string and returns all of the possible morphologic parse results for it.
35 | */
36 | public ListMorphologicParserCache
helps remembering parse results for inputs. Different implementations can exist:
29 | * offline, online with LRU, online with MFU ...
30 | */
31 | public interface MorphologicParserCache {
32 | ListExample | Term |
---|---|
gideceğini | Surface |
gideceğini+Noun | Surface+SurfacePos |
gidecek | Body |
gidecek+Noun | Body+BodyPos |
gideceğ | BodySurface |
gitmek | Lemma |
gitmek+Verb | Lemma+LemmaPos=Lexeme |
git | Root |
gid | RootSurface |
(y)AcAk | SuffixForm |
ecek | SuffixFormBody |
eceğ | SuffixFormSurface |
Term | Value | Value | Value |
---|---|---|---|
WordSurface | kitapçılığı | ||
Stems | kitap | kitapçı | kitapçılık |
StemSurfaces | kitap | kitapçı | kitapçılığ |
Body | kitapçılık | ||
BodySurface | kitapçılığ |