Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ne plus utiliser les RNN #29

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions alexi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from .label import Identificateur
from .search import search
from .segment import DEFAULT_MODEL as DEFAULT_SEGMENT_MODEL
from .segment import RNNSegmenteur, Segmenteur
from .segment import Segmenteur

LOGGER = logging.getLogger("alexi")
VERSION = "0.4.0"
Expand Down Expand Up @@ -60,10 +60,7 @@ def convert_main(args: argparse.Namespace):
def segment_main(args: argparse.Namespace):
"""Segmenter un CSV"""
crf: Segmenteur
if args.model.suffix == ".pt":
crf = RNNSegmenteur(args.model)
else:
crf = Segmenteur(args.model)
crf = Segmenteur(args.model)
reader = csv.DictReader(args.csv)
write_csv(crf(reader), sys.stdout)

Expand Down Expand Up @@ -144,7 +141,7 @@ def make_argparse() -> argparse.ArgumentParser:
"segment", help="Segmenter et étiquetter les segments d'un CSV"
)
segment.add_argument(
"--model", help="Modele CRF ou RNN", type=Path, default=DEFAULT_SEGMENT_MODEL
"--model", help="Modele CRF", type=Path, default=DEFAULT_SEGMENT_MODEL
)
segment.add_argument(
"csv",
Expand Down
9 changes: 3 additions & 6 deletions alexi/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from alexi.label import Identificateur
from alexi.link import Resolver
from alexi.segment import DEFAULT_MODEL as DEFAULT_SEGMENT_MODEL
from alexi.segment import DEFAULT_MODEL_NOSTRUCT, RNNSegmenteur, Segmenteur
from alexi.segment import DEFAULT_MODEL_NOSTRUCT, Segmenteur
from alexi.types import T_obj

LOGGER = logging.getLogger("extract")
Expand All @@ -39,7 +39,7 @@ def add_arguments(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
help="Ne pas utiliser le CSV de référence",
action="store_true",
)
parser.add_argument("--segment-model", help="Modele CRF/RNN", type=Path)
parser.add_argument("--segment-model", help="Modele CRF", type=Path)
parser.add_argument(
"--label-model", help="Modele CRF", type=Path, default=DEFAULT_LABEL_MODEL
)
Expand Down Expand Up @@ -342,10 +342,7 @@ def __init__(
self.outdir = outdir
self.crf_s = Identificateur()
if segment_model is not None:
if segment_model.suffix == ".pt":
self.crf = RNNSegmenteur(segment_model)
else:
self.crf = Segmenteur(segment_model)
self.crf = Segmenteur(segment_model)
self.crf_n = None
else:
self.crf = Segmenteur(DEFAULT_SEGMENT_MODEL)
Expand Down
Loading
Loading