def test_getTextLabelTuplesInSentences(self):
		info = self.info
		tuples = TextMarker.getTextLabelTuples(info)
		tupless = TextMarker.getTextLabelTuplesInSentences(info)
		# for tuples in tupless:
		# 	for tup in tuples:
		# 		print tup
		# 	print ''
		assert type(tupless) is list
		assert type(tupless[0]) is list
		assert type(tupless[0][0]) is tuple
		assert len(tuples) == len([item for tuples in tupless for item in tuples])
Beispiel #2
0
 def test_getTextLabelTuplesInSentences(self):
     info = self.info
     tuples = TextMarker.getTextLabelTuples(info)
     tupless = TextMarker.getTextLabelTuplesInSentences(info)
     # for tuples in tupless:
     # 	for tup in tuples:
     # 		print tup
     # 	print ''
     assert type(tupless) is list
     assert type(tupless[0]) is list
     assert type(tupless[0][0]) is tuple
     assert len(tuples) == len(
         [item for tuples in tupless for item in tuples])
 def test_getFeaturesInSentence(self):
 	lts = TextMarker.getTextLabelTuplesInSentences(self.info)
 	fword = FeatureExtractor.getFeaturesInSentence(lts[0])[0][0]
 	# for lt in lts:
 	# 	featuress = FeatureExtractor.getFeaturesInSentence(lt)
 	# 	print ''
 	# 	for x in featuress:
 	# 		print x
     assert "tok" in fword
     assert "tokkind" in fword
     assert "ne" in fword
     assert "contextfe" in fword
     assert "morphfe" in fword
     assert "posfe" in fword
     assert "bef1tok" in fword
     assert "bef1tokkind" in fword
     assert "bef1ne" in fword
     assert "bef1contextfe" in fword
     assert "bef1morphfe" in fword
     assert "bef1posfe" in fword
     assert "bef2tok" in fword
     assert "bef2tokkind" in fword
     assert "bef2ne" in fword
     assert "bef2contextfe" in fword
     assert "bef2morphfe" in fword
     assert "bef2posfe" in fword
Beispiel #4
0
 def test_getMarkedText(self):
     info = self.info
     mtext = TextMarker.getMarkedText(info)
     searchObj = re.findall(r'\[(.+?)\](.+?)\[.+?\]', mtext)
     # for x in searchObj:
     # 	print x
     # print mtext
     assert len(searchObj) > 1
	def test_getMarkedText(self):
		info = self.info
		mtext = TextMarker.getMarkedText(info)
		searchObj = re.findall( r'\[(.+?)\](.+?)\[.+?\]', mtext)
		# for x in searchObj:
		# 	print x
		# print mtext
		assert len(searchObj)>1
Beispiel #6
0
 def test_getTaggedText(self):
     info = self.info
     # print json.dumps(info, default=lambda o: o.__dict__, indent=2)
     # assert 1==2
     res = TextMarker.getTaggedText(info)
     assert "[bwhat]" in res
     assert "[bwho]" in res
     assert "[bwhen]" in res
     assert "[bwhere]" in res
     assert "[bwhy]" in res
     assert "[bhow]" in res
	def test_getTaggedText(self):
		info = self.info
		# print json.dumps(info, default=lambda o: o.__dict__, indent=2)
		# assert 1==2
		res = TextMarker.getTaggedText(info)
		assert "[bwhat]" in res
		assert "[bwho]" in res
		assert "[bwhen]" in res
		assert "[bwhere]" in res
		assert "[bwhy]" in res
		assert "[bhow]" in res
Beispiel #8
0
	def getFitursFromInfo(info5w1hs):
		fiturs = []
		for info in info5w1hs:
			# print info.text
			# print ''
			info = FeatureExtractor._INANLP(info)
			# print info.text
			# print ''
			for idxsentence, tupls in enumerate(TextMarker.getTextLabelTuplesInSentences(info)):
				# print tupls
				featuress = FeatureExtractor.getFeaturesInSentence("%d" % (idxsentence), tupls)
				for features in featuress:
					fiturs.append(features)	
		return fiturs
Beispiel #9
0
 def test_getOtherTaggedText(self):
     info = self.info
     res = TextMarker.getOtherTaggedText(info)
     # print res
     # print ''
     searchObj = re.findall(r'(\[b.+?\].+?\[e.+?\])', res)
     # for x in searchObj:
     # 	print x
     assert re.search(r'(\[bwhat\].+?\[ewhat\])', res)
     assert re.search(r'(\[bwho\].+?\[ewho\])', res)
     assert re.search(r'(\[bwhen\].+?\[ewhen\])', res)
     assert re.search(r'(\[bwhere\].+?\[ewhere\])', res)
     assert re.search(r'(\[bwhy\].+?\[ewhy\])', res)
     assert re.search(r'(\[bhow\].+?\[ehow\])', res)
     assert re.search(r'(\[bother\].+?\[eother\])', res)
	def test_getOtherTaggedText(self):
		info = self.info
		res = TextMarker.getOtherTaggedText(info)
		# print res
		# print ''
		searchObj = re.findall( r'(\[b.+?\].+?\[e.+?\])', res)
		# for x in searchObj:
		# 	print x
		assert re.search(r'(\[bwhat\].+?\[ewhat\])', res)
		assert re.search(r'(\[bwho\].+?\[ewho\])', res)
		assert re.search(r'(\[bwhen\].+?\[ewhen\])', res)
		assert re.search(r'(\[bwhere\].+?\[ewhere\])', res)
		assert re.search(r'(\[bwhy\].+?\[ewhy\])', res)
		assert re.search(r'(\[bhow\].+?\[ehow\])', res)
		assert re.search(r'(\[bother\].+?\[eother\])', res)
Beispiel #11
0
 def test_getTextLabelTuples(self):
     info = self.info
     tuples = TextMarker.getTextLabelTuples(info)
     assert len(tuples) > 0
     assert tuples[0]
     assert tuples[1]
Beispiel #12
0
 def test_getTaggedTexts(self):
     infos = MDP.get5w1h([6])
     res = TextMarker.getTaggedTexts(infos)
     assert len(res) > 1
	def test_getTextLabelTuples(self):
		info = self.info
		tuples = TextMarker.getTextLabelTuples(info)
		assert len(tuples)>0
		assert tuples[0]
		assert tuples[1]
	def test_getTaggedTexts(self):
		infos = MDP.get5w1h([6])
		res = TextMarker.getTaggedTexts(infos)
		assert len(res)>1