-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b104ec
commit e6cbbc3
Showing
8 changed files
with
61 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from sblex.application.queries.fullforms import FullformQuery | ||
from sblex.application.queries.inflection import GenerateInflectionTable | ||
from sblex.application.queries.lex_fullforms import FullformLexQuery | ||
from sblex.application.queries.lookup_lid import LookupLid | ||
|
||
__all__ = ["FullformLexQuery", "LookupLid", "FullformQuery"] | ||
__all__ = ["FullformLexQuery", "LookupLid", "FullformQuery", "GenerateInflectionTable"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import abc | ||
from typing import Iterable, TypedDict | ||
|
||
|
||
class InflectionTableRow(TypedDict): | ||
form: str | ||
gf: str | ||
pos: str | ||
inhs: list[str] | ||
msd: str | ||
p: str | ||
|
||
|
||
class GenerateInflectionTable(abc.ABC): | ||
@abc.abstractmethod | ||
def query(self, paradigm: str, word: str) -> Iterable[InflectionTableRow]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from sblex.fm.fm_runner import FMrunner | ||
from sblex.fm.fm_runner import FmRunner | ||
from sblex.fm.morphology import MemMorphology, Morphology | ||
|
||
__all__ = ["FMrunner", "Morphology", "MemMorphology"] | ||
__all__ = ["FmRunner", "Morphology", "MemMorphology"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from sblex.infrastructure.queries.fm_runner_inflection import FmRunnerInflectionTable | ||
from sblex.infrastructure.queries.http_morpology import HttpMorphology | ||
from sblex.infrastructure.queries.lookup_lex_fullforms import LookupFullformLexQuery | ||
from sblex.infrastructure.queries.mem_lookup_lid import MemLookupLid | ||
|
||
__all__ = ["HttpMorphology", "MemLookupLid", "LookupFullformLexQuery"] | ||
__all__ = ["HttpMorphology", "MemLookupLid", "LookupFullformLexQuery", "FmRunnerInflectionTable"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from typing import Iterable | ||
|
||
from sblex.application.queries import GenerateInflectionTable | ||
from sblex.application.queries.inflection import InflectionTableRow | ||
from sblex.fm import FmRunner | ||
|
||
|
||
class FmRunnerInflectionTable(GenerateInflectionTable): | ||
def __init__(self, *, fm_runner: FmRunner) -> None: | ||
super().__init__() | ||
self.fm_runner = fm_runner | ||
|
||
def query(self, paradigm: str, word: str) -> Iterable[InflectionTableRow]: | ||
for row in self.fm_runner.inflection(paradigm, word): | ||
yield { | ||
"form": row["word"], | ||
"gf": row["head"], | ||
"pos": row["pos"], | ||
"inhs": row["inhs"], | ||
"msd": row["param"], | ||
"p": row["p"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters