Skip to content

Commit

Permalink
Small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
fbanados committed Nov 11, 2024
1 parent ebd36b7 commit 08746ca
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/morphodict/search/espt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import logging
import re
from dataclasses import dataclass

from morphodict.phrase_translate.tag_maps import (
Expand Down Expand Up @@ -126,13 +125,7 @@ def inflect_search_results(self):
)
)

def _generate_inflected_results(self) -> list[_EipResult]:
"""
From the results, sort out the inflectable wordforms, then inflect them
using the new set of tags.
Return the inflected wordforms.
"""

def _collect_non_inflected_results(self) -> list[Result]:
words = []
for r in self.search_run.unsorted_results():
if not r.is_lemma:
Expand All @@ -147,6 +140,17 @@ def _generate_inflected_results(self) -> list[_EipResult]:
if "+N" in self.new_tags and r.is_lemma and "+N" in analysis_tags:
words.append(r)

return words

def _generate_inflected_results(self) -> list[_EipResult]:
"""
From the results, sort out the inflectable wordforms, then inflect them
using the new set of tags.
Return the inflected wordforms.
"""

words = self._collect_non_inflected_results()

orig_tags_starting_with_plus: list[str] = []
tags_ending_with_plus: list[str] = []
for t in self.new_tags:
Expand Down

0 comments on commit 08746ca

Please sign in to comment.