import csv
import sys

# load data
filename = 'dataminer.csv'
file = open(filename, 'rt', encoding='utf-8')
text = file.read()

# split text to sentences, with list of slovak abbreviations
from nltk.tokenize.punkt import PunktSentenceTokenizer, PunktParameters
punkt_param = PunktParameters()
punkt_param.abbrev_types = set([
        'rokov', 'sgt', 'ing', 'storočia', 't.j', 'kr', 'resp', 'poľ', 'tzv', 'i', 'hebr',
        'pod', 'napr', 'prof', 'angl', 'lat', 'maď', 'nem', 'franc','slov', 'skr', 'mil',
        'gr', 'ssp', 'chorv', 'hovor', 'príp', 'sv', 'č', 'stor', 'nór', 'sans',
        'starogr', 'arab', 'aram', 'r', 'h.m', 'jr', 'tal', 'j',
        '2', '5', '6', '8', '15', 'atď', 'október', 'ii', 'iii', 'v', 'n', 'm'])
sentence_splitter = PunktSentenceTokenizer(punkt_param)
sentences = sentence_splitter.tokenize(text)

sys.stdout = open("textfile.csv", "w", encoding='utf-8')
print("text")
for sentences in sentence_splitter.tokenize(text):
    print(sentences)
sys.stdout.close()
quit()

        
        