Ejemplo 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
Ejemplo n.º 2
0
 def setUp(self):
     self.filePath = 'my_tagger.yaml'
     self.tag = Tagger.load(self.filePath)
Ejemplo n.º 3
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
Ejemplo n.º 4
0
 def test_load_nonexisting(self):
     with self.assertRaises(FileNotFoundError):
         Tagger.load("this_file_definitely_doesnt_exist.txt")
Ejemplo n.º 5
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)
Ejemplo n.º 6
0
 def test_load_file(self):
     tagger = Tagger.load(self.filePath)
     self.assertIsInstance(tagger.myTagger, BrillTagger)
Ejemplo n.º 7
0
 def setUp(self):
     self.filePath = 'my_tagger.yaml'
     self.tag = Tagger.load(self.filePath)
Ejemplo 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)
Ejemplo n.º 9
0
 def test_load_nonexisting(self):
     with self.assertRaises(FileNotFoundError):
         Tagger.load("this_file_definitely_doesnt_exist.txt")
Ejemplo n.º 10
0
 def test_load_file(self):
     tagger = Tagger.load(self.filePath)
     self.assertIsInstance(tagger.myTagger, BrillTagger)