Esempio n. 1
0
# -*- coding: cp1254 -*-

# Onur Yilmaz

# Imports
from Tagger import Tagger

# Open the file where tagger is saved
taggerFileName = 'my_tagger.yaml'
myTagger = Tagger.load(taggerFileName)


# Keep the original functionality intact
def tag(sentence):
    return myTagger.tag(sentence)


# End of code
 def setUp(self):
     self.filePath = 'my_tagger.yaml'
     self.tag = Tagger.load(self.filePath)
# -*- coding: cp1254 -*-

# Onur Yilmaz

# Imports
from Tagger import Tagger

# Open the file where tagger is saved
taggerFileName = 'my_tagger.yaml'
myTagger = Tagger.load(taggerFileName)

# Keep the original functionality intact
def tag(sentence):
    return myTagger.tag(sentence)

# End of code
 def test_load_nonexisting(self):
     with self.assertRaises(FileNotFoundError):
         Tagger.load("this_file_definitely_doesnt_exist.txt")
 def test_load_incorrectly(self):
     temporaryFileName = os.path.join(self.tempDir, 'temporary_file.txt')
     with open(temporaryFileName, 'w') as file:
         file.write("This is a line that won't be able to be read")
     with self.assertRaises(TypeError):
         Tagger.load(temporaryFileName)
 def test_load_file(self):
     tagger = Tagger.load(self.filePath)
     self.assertIsInstance(tagger.myTagger, BrillTagger)
Esempio n. 7
0
 def setUp(self):
     self.filePath = 'my_tagger.yaml'
     self.tag = Tagger.load(self.filePath)
Esempio n. 8
0
 def test_load_incorrectly(self):
     temporaryFileName = os.path.join(self.tempDir, 'temporary_file.txt')
     with open(temporaryFileName, 'w') as file:
         file.write("This is a line that won't be able to be read")
     with self.assertRaises(TypeError):
         Tagger.load(temporaryFileName)
Esempio n. 9
0
 def test_load_nonexisting(self):
     with self.assertRaises(FileNotFoundError):
         Tagger.load("this_file_definitely_doesnt_exist.txt")
Esempio n. 10
0
 def test_load_file(self):
     tagger = Tagger.load(self.filePath)
     self.assertIsInstance(tagger.myTagger, BrillTagger)