当前位置: 首页>>代码示例>>Python>>正文


Python query.get_assertion_definitions函数代码示例

本文整理汇总了Python中whoami.query.get_assertion_definitions函数的典型用法代码示例。如果您正苦于以下问题:Python get_assertion_definitions函数的具体用法?Python get_assertion_definitions怎么用?Python get_assertion_definitions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_assertion_definitions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_adjective_definition

 def test_adjective_definition(self):
     # Artificial sentence
     sentence = u'The Great Pyramid of Giza is the oldest of the three pyramids in Gyza.'
     expected = [u'pyramid', u'oldest pyramid', 'gyza pyramid']
     actual, entry = get_assertion_definitions(sentence, get_rep=True)
     self.assertItemsEqual(expected, actual)
     self.assertTrue(u'[mod: oldest' in entry)
开发者ID:infolab-csail,项目名称:whoami,代码行数:7,代码来源:test_assertion_definitions.py

示例2: test_proper_noun

 def test_proper_noun(self):
     # artificial sentence
     sentence = u'Lee is an American engineer, computer scientist and iOS and internet expert'
     expected = [u'internet expert', u'computer scientist', u'expert', u'american',
                 u'scientist', u'american engineer', u'engineer']  # filtered out 'iOS'
     actual = get_assertion_definitions(sentence)
     self.assertItemsEqual(expected, actual)
开发者ID:infolab-csail,项目名称:whoami,代码行数:7,代码来源:test_assertion_definitions.py

示例3: test_one_word_entity

 def test_one_word_entity(self):
     sentence = u'Alan Mathison Turing was a British pioneering computer scientist, mathematician, logician, cryptanalyst, philosopher, mathematical biologist, and marathon and ultra distance runner.'
     expected = [u'computer scientist', u'ultra runner', u'mathematician', u'distance runner',
                 u'mathematical biologist', u'philosopher', u'runner', u'logician', u'scientist',
                 u'british', u'british scientist', u'pioneering scientist', u'biologist']  # filtered out 'marathon'
     actual = get_assertion_definitions(sentence)
     self.assertItemsEqual(expected, actual)
开发者ID:infolab-csail,项目名称:whoami,代码行数:7,代码来源:test_assertion_definitions.py

示例4: test_compound_noun_whole

 def test_compound_noun_whole(self):
     # artificial sentence
     sentence = u'Lee is an American engineer, computer scientist and computer system and internet expert.'
     expected = [u'internet expert', u'computer scientist', u'expert', u'american', u'scientist',
                 u'american engineer', u'engineer']  # filtered out 'system' and 'computer system'
     actual = get_assertion_definitions(sentence)
     self.assertItemsEqual(expected, actual)
开发者ID:infolab-csail,项目名称:whoami,代码行数:7,代码来源:test_assertion_definitions.py

示例5: test_two_of

 def test_two_of(self):
     # Artificial sentence
     sentence = u'Ben and Jerry were two of the most successful ice cream makers in the world.'
     expected = [u'maker', u'cream maker', u'ice cream maker', u'successful maker', u'world maker']
     actual, entry = get_assertion_definitions(sentence, get_rep=True)
     self.assertItemsEqual(expected, actual)
     self.assertTrue(u'[nummod: two' in entry)
开发者ID:infolab-csail,项目名称:whoami,代码行数:7,代码来源:test_assertion_definitions.py

示例6: test_plural_subject

 def test_plural_subject(self):
     sentence = u'Business method patents are a class of patents which disclose and claim new methods of doing business.'
     expected = [u'class', u'patent']
     actual, entry = get_assertion_definitions(sentence, subject=[u'Business method patent'], get_rep=True)
     self.assertItemsEqual(expected, actual)
     self.assertFalse(u'subject: subject_number' in entry)
     self.assertTrue(u'subject: Business method patents' in entry)
开发者ID:infolab-csail,项目名称:whoami,代码行数:7,代码来源:test_assertion_definitions.py

示例7: test_cardinal

 def test_cardinal(self):
     sentence = u'Certis CISCO Security Private Limited, formerly CISCO Security Private Limited, is one of the five commercial Auxiliary Police forces authorized to provide armed security officers to government organizations as well as private companies or individuals in Singapore.'
     # Spacy awkwardly attaches [commercial] to [auxiliary police] rather
     # than to [force]
     expected = [u'commercial auxiliary police force', u'auxiliary police force', u'force', u'police force']
     actual = get_assertion_definitions(sentence, get_rep=False)
     self.assertItemsEqual(expected, actual)
开发者ID:infolab-csail,项目名称:whoami,代码行数:7,代码来源:test_assertion_definitions.py

示例8: test_ordinals_word_number_date

 def test_ordinals_word_number_date(self):
     sentence = u'The 2001 French Open was the second Grand Slam event of 2001 and the 100th edition of the French Open.'
     expected = [u'event', u'grand slam event', u'2001 event', u'edition', u'french open edition']
     # TODO-someday: [2001] in the subject [The 2001 French Open] is
     # recognized as ROOT, so we need to help whoami by telling what the
     # subject is. Maybe try undoing this in future spacy versions.
     actual, entry = get_assertion_definitions(sentence, get_rep=True, subject=[u'The 2001 French Open'])
     self.assertItemsEqual(expected, actual)
     self.assertTrue(u'[mod: second' in entry)
     self.assertTrue(u'[mod: 100th' in entry)
开发者ID:infolab-csail,项目名称:whoami,代码行数:10,代码来源:test_assertion_definitions.py

示例9: test_phrasal_norp

 def test_phrasal_norp(self):
     sentence = u'Municipal Pérez Zeledón is a Costa Rican football team playing at the top level in the Primera Division.'
     expected = [u'costa rican team', u'team', u'football team']
     actual = get_assertion_definitions(sentence, get_rep=False)
     self.assertItemsEqual(expected, actual)
开发者ID:infolab-csail,项目名称:whoami,代码行数:5,代码来源:test_assertion_definitions.py

示例10: test_person_longer

 def test_person_longer(self):
     sentence = u'Richard Harry Chapura Jr. is a former American professional football player who was a defensive tackle in the National Football League and the World League of American Football.'
     expected = [u'player', u'football player', u'former player', u'professional player', 'american player', u'american']
     actual = get_assertion_definitions(sentence, get_rep=False)
     self.assertItemsEqual(expected, actual)
开发者ID:infolab-csail,项目名称:whoami,代码行数:5,代码来源:test_assertion_definitions.py

示例11: test_number_written

 def test_number_written(self):
     sentence = u'One is the smallest integer that is strictly positive.'
     expected = [u'integer', u'smallest integer']
     actual = get_assertion_definitions(sentence, get_rep=False)
     self.assertItemsEqual(expected, actual)
开发者ID:infolab-csail,项目名称:whoami,代码行数:5,代码来源:test_assertion_definitions.py

示例12: test_number

 def test_number(self):
     sentence = u'5 is a lovely number.'
     expected = [u'number', u'lovely number']
     actual = get_assertion_definitions(sentence, get_rep=False)
     self.assertItemsEqual(expected, actual)
开发者ID:infolab-csail,项目名称:whoami,代码行数:5,代码来源:test_assertion_definitions.py

示例13: test_year

 def test_year(self):
     sentence = u'1066 (MLXVI) was a common year starting on Sunday of the Julian calendar.'
     expected = [u'common year', 'year']
     actual = get_assertion_definitions(sentence, get_rep=False)
     self.assertItemsEqual(expected, actual)
开发者ID:infolab-csail,项目名称:whoami,代码行数:5,代码来源:test_assertion_definitions.py

示例14: test_prep_before_beverb

 def test_prep_before_beverb(self):
     sentence = u"Titanic Quarter in Belfast, Northern Ireland is a large-scale waterfront regeneration, comprising historic maritime landmarks, film studios, education facilities, apartments, a riverside entertainment district, and the world's largest Titanic-themed attraction centred on land in Belfast Harbour, known until 1995 as Queen's Island."
     expected = [u'waterfront regeneration', u'large-scale waterfront regeneration', u'belfast regeneration', u'regeneration']
     actual = get_assertion_definitions(sentence, get_rep=False)
     self.assertItemsEqual(expected, actual)
开发者ID:infolab-csail,项目名称:whoami,代码行数:5,代码来源:test_assertion_definitions.py

示例15: test_multiple_spaces

 def test_multiple_spaces(self):
     sentence = u'Wolfgang Amadeus Mozart, baptised as Johannes Chrysostomus Wolfgangus Theophilus Mozart, was a prolific and influential composer of the Classical era.'
     subject = [u'Wolfgang Amadeus Mozart  ', u'Johannes Chrysostomus Wolfgangus Theophilus Mozart']
     expected = [u'era composer', u'influential composer', u'prolific composer', u'composer', u'classical era composer']
     actual = get_assertion_definitions(sentence, subject)
开发者ID:infolab-csail,项目名称:whoami,代码行数:5,代码来源:test_assertion_definitions.py


注:本文中的whoami.query.get_assertion_definitions函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。