Skip to content

Commit

Permalink
Merge pull request #18 from mideind/compound-lookup
Browse files Browse the repository at this point in the history
Add handling to prioritize getting compound structure of words found in BÍN
  • Loading branch information
vthorsteinsson authored Nov 15, 2023
2 parents 5b69065 db7e2cc commit 43141ff
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/islenska/bindb.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 379,6 @@ def _lookup(
lookup_func: LookupFunc[_T],
ctor: EntryCtor[_T],
) -> ResultTuple[_T]:

"""Lookup a simple or compound word in the database and
return its meaning(s). This function checks for abbreviations,
upper/lower case variations, etc."""
Expand Down Expand Up @@ -837,6 836,18 @@ def cast_to_genitive(
filter_func=filter_func,
)

def get_compound(
self, w: str, at_sentence_start: bool = False
) -> ResultTuple[BinEntry]:
"""Lookup a word in the database and return its meaning(s),
prioritizing returning its compound structure."""

w, m = self._compound_meanings(
w, w.lower(), at_sentence_start, self._meanings_cache_lookup, make_bin_entry
)

return w, m


class GreynirBin(Bin):

Expand Down

0 comments on commit 43141ff

Please sign in to comment.