Skip to content

Commit

Permalink
#107 done
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolay-r committed Oct 14, 2023
1 parent 6b2bee1 commit 5663361
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion arelight/run/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
cmd_args.TermsPerContextArg.add_argument(parser, default=50)
parser.add_argument('--text', dest='input_text', type=str, default=None, nargs='?', help='Input text for processing')
parser.add_argument('--from-files', dest='from_files', type=str, default=None, nargs='+')
parser.add_argument('--csv-sep', dest='csv_sep', type=str, default=',', nargs='?')
parser.add_argument('--collection-name', dest='collection_name', type=str, default=None, nargs='+')
parser.add_argument('--ner-model-name', dest='ner_model_name', type=str, default="ner_ontonotes_bert_mult")
parser.add_argument('--synonyms-filepath', dest='synonyms_filepath', type=str, default=None, help="List of synonyms provided in lines of the source text file.")
Expand Down Expand Up @@ -73,7 +74,7 @@

# Reading text-related parameters.
sentence_parser = cmd_args.SentenceParserArg.read_argument(args)
texts_from_files = read_files(args.from_files)
texts_from_files = read_files(paths=args.from_files, delimiter=args.csv_sep)
text_from_arg = args.input_text
ner_framework = args.ner_framework
ner_model_name = args.ner_model_name
Expand Down
4 changes: 2 additions & 2 deletions arelight/run/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def merge_dictionaries(dict_iter):
return merged_dict


def read_files(paths):
def read_files(paths, delimiter):

if paths is None:
return None
Expand All @@ -99,7 +99,7 @@ def read_files(paths):
if path.endswith(".csv"):
# Handle as a column from the csv file.
pd = importlib.import_module("pandas")
df = pd.read_csv(path, delimiter=",")
df = pd.read_csv(path, delimiter=delimiter)
file_contents.extend(df["text"].astype(str).to_list())
else:
# Handle as a normal file.
Expand Down

0 comments on commit 5663361

Please sign in to comment.