diff --git a/code/src/file_reader.py b/code/src/file_reader.py new file mode 100644 index 0000000..36ae5da --- /dev/null +++ b/code/src/file_reader.py @@ -0,0 +1,22 @@ +from abc import abstractmethod +import pandas as pd +from bs4 import BeautifulSoup + +class FileReader(): + def __init__(self): + pass + + @abstractmethod + def annotate(self, text): + f = open(text,'r') + return f.read() + + def make_dict(self, list_of_inside_tag_strings, fucntion): + dictionary = {string: fucntion(string) for string in list_of_inside_tag_strings} + return dictionary + + def read_csv(self, path, sep): + return pd.read_csv(path, index_col=None, sep=sep) + + def read_xml(self, text): + return BeautifulSoup(''+text+'', "lxml")