Skip to content
Open
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
22 changes: 22 additions & 0 deletions code/src/file_reader.py
Original file line number Diff line number Diff line change
@@ -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>'+text+'</text>', "lxml")