mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.10.3.1
This commit is contained in:
@@ -17,5 +17,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.langs.grammars; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
|
||||
public interface Xol_grammar {
|
||||
boolean Grammar_eval(Bry_bfr bfr, Xol_lang lang, byte[] word, byte[] type);
|
||||
boolean Grammar_eval(Bry_bfr bfr, Xol_lang_itm lang, byte[] word, byte[] type);
|
||||
}
|
||||
|
||||
@@ -38,18 +38,18 @@ public class Xol_grammar_ {
|
||||
}
|
||||
public static Xol_grammar new_by_lang_id(int lang_id) {
|
||||
switch (lang_id) {
|
||||
case Xol_lang_itm_.Id_fi: return new Xol_grammar_fi();
|
||||
case Xol_lang_itm_.Id_ru: return new Xol_grammar_ru();
|
||||
case Xol_lang_itm_.Id_pl: return Xol_grammar__noop._;
|
||||
default: return Xol_grammar__unimplemented._;
|
||||
case Xol_lang_stub_.Id_fi: return new Xol_grammar_fi();
|
||||
case Xol_lang_stub_.Id_ru: return new Xol_grammar_ru();
|
||||
case Xol_lang_stub_.Id_pl: return Xol_grammar__noop.Instance;
|
||||
default: return Xol_grammar__unimplemented.Instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
class Xol_grammar__unimplemented implements Xol_grammar {
|
||||
public boolean Grammar_eval(Bry_bfr bfr, Xol_lang lang, byte[] word, byte[] type) {return false;}
|
||||
public static final Xol_grammar__unimplemented _ = new Xol_grammar__unimplemented(); Xol_grammar__unimplemented() {}
|
||||
public boolean Grammar_eval(Bry_bfr bfr, Xol_lang_itm lang, byte[] word, byte[] type) {return false;}
|
||||
public static final Xol_grammar__unimplemented Instance = new Xol_grammar__unimplemented(); Xol_grammar__unimplemented() {}
|
||||
}
|
||||
class Xol_grammar__noop implements Xol_grammar {
|
||||
public boolean Grammar_eval(Bry_bfr bfr, Xol_lang lang, byte[] word, byte[] type) {bfr.Add(word); return true;}
|
||||
public static final Xol_grammar__noop _ = new Xol_grammar__noop(); Xol_grammar__noop() {}
|
||||
public boolean Grammar_eval(Bry_bfr bfr, Xol_lang_itm lang, byte[] word, byte[] type) {bfr.Add(word); return true;}
|
||||
public static final Xol_grammar__noop Instance = new Xol_grammar__noop(); Xol_grammar__noop() {}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.langs.grammars; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
|
||||
import gplx.core.primitives.*; import gplx.core.btries.*;
|
||||
import gplx.xowa.urls.*;
|
||||
import gplx.xowa.apps.urls.*;
|
||||
public class Xol_grammar_fi implements Xol_grammar {
|
||||
public boolean Vowel_harmony(byte[] word, int word_len) {
|
||||
// $aou = preg_match( '/[aou][^äöy]*$/i', $word );
|
||||
@@ -35,7 +35,7 @@ public class Xol_grammar_fi implements Xol_grammar {
|
||||
}
|
||||
return aou_found;
|
||||
}
|
||||
public boolean Grammar_eval(Bry_bfr bfr, Xol_lang lang, byte[] word, byte[] type) {
|
||||
public boolean Grammar_eval(Bry_bfr bfr, Xol_lang_itm lang, byte[] word, byte[] type) {
|
||||
if (Bry_.Len_eq_0(word)) return true; // empty_string returns ""
|
||||
byte tid = Xol_grammar_.Tid_of_type(type);
|
||||
if (tid == Xol_grammar_.Tid_unknown) {bfr.Add(word); return true;} // unknown type returns word
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Xol_grammar_ru implements Xol_grammar {
|
||||
Xol_grammar_ru_genitive_itm itm = new Xol_grammar_ru_genitive_itm(tid, find_bry, repl_bry);
|
||||
trie.Add(find_bry, itm);
|
||||
}
|
||||
public boolean Grammar_eval(Bry_bfr bfr, Xol_lang lang, byte[] word, byte[] type) {
|
||||
public boolean Grammar_eval(Bry_bfr bfr, Xol_lang_itm lang, byte[] word, byte[] type) {
|
||||
if (Bry_.Len_eq_0(word)) return true; // empty_string returns ""
|
||||
byte tid = Xol_grammar_.Tid_of_type(type);
|
||||
switch (tid) {
|
||||
|
||||
Reference in New Issue
Block a user