Skip to content

PYTHON-PACKAGE-005 clearing out the outdir before running the analyzer #13

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

Merged
merged 1 commit into from
Aug 5, 2024
Merged
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
6 changes: 6 additions & 0 deletions NLPPlus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from os import PathLike, getcwd
from pathlib import Path
from typing import Optional, Any
import os
import glob

from .bindings import NLP_ENGINE # type: ignore

Expand Down Expand Up @@ -112,6 +114,10 @@ def analyze(self, text: str, analyzer_name: str) -> Results:
if self.analyzer_path:
analyzer_name = Path(self.analyzer_path) / analyzer_name
outdir = Path(self.analyzer_path) / "analyzers" / analyzer_name / "output"
# Delete all files in the outdir
file_list = glob.glob(str(outdir / "*"))
for file_path in file_list:
os.remove(file_path)
outtext = self.engine.analyze(str(analyzer_name), text)
return Results(outtext, outdir)

Expand Down
Loading