def testBoat(self): # throws Exception page = self.parse("boat.txt") entry = page.getEntry(0) actualIter = List(entry.getReferences()).iterator() self.assertEqual( "Weisenberg, Michael (2000) ''[http://www.poker1.com/mcu/pokerdictionary/mculib_dictionary_info.asp The Official Dictionary of Poker].'' MGI/Mike Caro University. ISBN 978-1880069523", actualIter.next().getText()) self.assertFalse(actualIter.hasNext()) entry = page.getEntry(1) actualIter = List(entry.getReferences()).iterator() self.assertFalse(actualIter.hasNext())
def testForGoodMeasure(self): # throws Exception page = self.parse("for_good_measure.txt") senseIter = List(page.getEntry(0).getSenses()).iterator() self.assertEqual( "{{idiomatic}} In excess of the minimum required; Added as an [[extra]]", senseIter.next().getGloss().getText()) self.assertFalse(senseIter.hasNext())
def testSynonymsDictionary(self): # throws Exception page = self.parse("dictionary.txt") entry = page.getEntry(0) iter_ = List(entry.getUnassignedSense().getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "wordbook", iter_.next()) self.assertFalse(iter_.hasNext())
def testSynonymsGoitrogenic(self): # throws Exception page = self.parse("goitrogenic.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(1).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "antithyroid", iter_.next()) self.assertFalse(iter_.hasNext())
def testSynonymsShutUp(self): # throws Exception page = self.parse("shut_up.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(6).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "be quiet", iter_.next()) self.assertRelation(RelationType.SYNONYM, "be silent", iter_.next()) self.assertRelation(RelationType.SYNONYM, "fall silent", iter_.next()) self.assertRelation(RelationType.SYNONYM, "hush", iter_.next()) self.assertRelation(RelationType.SYNONYM, "quieten down", iter_.next()) self.assertRelation(RelationType.SYNONYM, "shush", iter_.next()) self.assertRelation(RelationType.SYNONYM, "be quiet!", iter_.next()) self.assertRelation(RelationType.SYNONYM, "can it!", iter_.next()) self.assertRelation(RelationType.SYNONYM, "hush!", iter_.next()) self.assertRelation(RelationType.SYNONYM, "put a sock in it!", iter_.next()) self.assertRelation(RelationType.SYNONYM, "quiet!", iter_.next()) self.assertRelation(RelationType.SYNONYM, "sh!", iter_.next()) self.assertRelation(RelationType.SYNONYM, "shush!", iter_.next()) self.assertRelation(RelationType.SYNONYM, "shut it!", iter_.next()) self.assertRelation(RelationType.SYNONYM, "shut your face!", iter_.next()) self.assertRelation(RelationType.SYNONYM, "shaddap", iter_.next()) self.assertRelation(RelationType.SYNONYM, "silence!", iter_.next()) self.assertRelation(RelationType.SYNONYM, "st!", iter_.next()) self.assertRelation(RelationType.SYNONYM, "STFU", iter_.next()) self.assertFalse(iter_.hasNext())
def testAbate(self): # throws Exception page = self.parse("abate.txt") entry = page.getEntry(0) actualIter = List(entry.getReferences()).iterator() self.assertEqual("{{R:OneLook}}", actualIter.next().getText()) self.assertEqual("{{R:Webster 1913}}", actualIter.next().getText()) self.assertFalse(actualIter.hasNext()) entry = page.getEntry(1) actualIter = List(entry.getReferences()).iterator() self.assertEqual("{{R:OneLook}}", actualIter.next().getText()) self.assertEqual("{{R:Webster 1913}}", actualIter.next().getText()) self.assertFalse(actualIter.hasNext()) entry = page.getEntry(2) actualIter = List(entry.getReferences()).iterator() self.assertFalse(actualIter.hasNext())
def testSynonymsLung(self): # throws Exception page = self.parse("lung.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(1).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "bellows", iter_.next()) self.assertRelation(RelationType.SYNONYM, "lights", iter_.next()) self.assertFalse(iter_.hasNext())
def testSynonymsAbdominal(self): # throws Exception page = self.parse("abdominal.txt") entry = page.getEntry(1) iter_ = List(entry.getSense(1).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "Cypriniformes", iter_.next()) self.assertFalse(iter_.hasNext())
def testRelationsDescendantsDid(self): # throws Exception page = self.parse("did.txt") entry = page.getEntry(2) iter_ = List(entry.getUnassignedSense().getRelations( RelationType.DESCENDANT)).iterator() self.assertTrue(iter_.hasNext()) self.assertRelation(RelationType.DESCENDANT, "Welsh: dydd", iter_.next()) self.assertFalse(iter_.hasNext())
def testSynonymsDrink(self): # throws Exception page = self.parse("drink.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(2).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "gulp", iter_.next()) self.assertRelation(RelationType.SYNONYM, "imbibe", iter_.next()) self.assertRelation(RelationType.SYNONYM, "quaff", iter_.next()) self.assertRelation(RelationType.SYNONYM, "sip", iter_.next())
def testSynonymsHead(self): # throws Exception page = self.parse("head.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(13).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "headmaster", iter_.next()) self.assertRelation(RelationType.SYNONYM, "headmistress", iter_.next()) self.assertRelation(RelationType.SYNONYM, "principal", iter_.next()) self.assertFalse(iter_.hasNext())
def testSynonymsAbreast(self): # throws Exception page = self.parse("abreast.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(1).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "apprised", iter_.next()) self.assertRelation(RelationType.SYNONYM, "up to date/up-to-date", iter_.next()) self.assertFalse(iter_.hasNext())
def testSynonymsWallpaper(self): # throws Exception page = self.parse("wallpaper.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(3).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "desktop image", iter_.next()) self.assertRelation(RelationType.SYNONYM, "desktop pattern", iter_.next()) self.assertFalse(iter_.hasNext())
def testSynonymsPound(self): # throws Exception page = self.parse("pound.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(5).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "£", iter_.next()) self.assertRelation(RelationType.SYNONYM, "pound sterling", iter_.next()) self.assertRelation(RelationType.SYNONYM, "punt", iter_.next()) self.assertFalse(iter_.hasNext())
def testAntonymsKiefer(self): # throws Exception page = self.parse("cow.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(1).getRelations( RelationType.ANTONYM)).iterator() self.assertRelation(RelationType.ANTONYM, "bull", iter_.next()) self.assertRelation(RelationType.ANTONYM, "ox", iter_.next()) self.assertRelation(RelationType.ANTONYM, "steer", iter_.next()) self.assertRelation(RelationType.ANTONYM, "heifer", iter_.next()) self.assertFalse(iter_.hasNext())
def testSynonymsTermination(self): # throws Exception page = self.parse("termination.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(1).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "concluding", iter_.next()) self.assertRelation(RelationType.SYNONYM, "ending", iter_.next()) self.assertRelation(RelationType.SYNONYM, "finishing", iter_.next()) self.assertRelation(RelationType.SYNONYM, "stoping", iter_.next()) self.assertRelation(RelationType.SYNONYM, "terminating", iter_.next()) self.assertFalse(iter_.hasNext()) iter_ = List(entry.getSense(2).getRelations( RelationType.SYNONYM)).iterator() self.assertFalse(iter_.hasNext()) iter_ = List(entry.getSense(3).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "close", iter_.next()) self.assertRelation(RelationType.SYNONYM, "conclusion", iter_.next()) self.assertRelation(RelationType.SYNONYM, "end", iter_.next()) self.assertRelation(RelationType.SYNONYM, "finale", iter_.next()) self.assertRelation(RelationType.SYNONYM, "finish", iter_.next()) self.assertRelation(RelationType.SYNONYM, "stop", iter_.next()) self.assertFalse(iter_.hasNext()) iter_ = List(entry.getSense(4).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "border", iter_.next()) self.assertRelation(RelationType.SYNONYM, "edge", iter_.next()) self.assertRelation(RelationType.SYNONYM, "end", iter_.next()) self.assertRelation(RelationType.SYNONYM, "limit", iter_.next()) self.assertRelation(RelationType.SYNONYM, "lip", iter_.next()) self.assertRelation(RelationType.SYNONYM, "rim", iter_.next()) self.assertRelation(RelationType.SYNONYM, "tip", iter_.next()) self.assertFalse(iter_.hasNext()) iter_ = List(entry.getSense(5).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "consequence", iter_.next()) self.assertRelation(RelationType.SYNONYM, "outcome", iter_.next()) self.assertRelation(RelationType.SYNONYM, "result", iter_.next()) self.assertRelation(RelationType.SYNONYM, "upshot", iter_.next()) self.assertFalse(iter_.hasNext()) iter_ = List(entry.getSense(6).getRelations( RelationType.SYNONYM)).iterator() self.assertFalse(iter_.hasNext()) iter_ = List(entry.getSense(7).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "abortion", iter_.next()) self.assertRelation(RelationType.SYNONYM, "induced abortion", iter_.next()) self.assertFalse(iter_.hasNext()) iter_ = List(entry.getUnassignedSense().getRelations( RelationType.SYNONYM)).iterator() self.assertFalse(iter_.hasNext())
def testSynonymsCallously(self): # throws Exception page = self.parse("callously.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(1).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "carelessly", iter_.next()) self.assertRelation(RelationType.SYNONYM, "hardheartedly", iter_.next()) self.assertRelation(RelationType.SYNONYM, "indifferently", iter_.next()) self.assertRelation(RelationType.SYNONYM, "unfeelingly", iter_.next()) self.assertFalse(iter_.hasNext())
def testBatsman(self): # throws Exception page = self.parse("batsman.txt") senseIter = List(page.getEntry(0).getSenses()).iterator() self.assertEqual( "{{cricket}} A [[player]] of the [[batting]] [[side]] now on the [[field]]", senseIter.next().getGloss().getText()) self.assertEqual( "{{cricket}} The [[player]] now [[receiving]] [[strike]]; the [[striker]]", senseIter.next().getGloss().getText()) self.assertEqual( "{{cricket}} Any player selected for his or her [[team]] principally to [[bat]], as opposed to a [[bowler]]", senseIter.next().getGloss().getText()) self.assertFalse(senseIter.hasNext())
def testAbalone(self): # throws Exception page = self.parse("abalone.txt") entry = page.getEntry(0) actualIter = List(entry.getReferences()).iterator() self.assertEqual("{{wikisource1911Enc|Abalone}}", actualIter.next().getText()) self.assertEqual("{{pedialite|Abalone}}", actualIter.next().getText()) self.assertEqual("{{R:American Heritage 2000|abalone}}", actualIter.next().getText()) self.assertEqual("{{R:Dictionary.com|abalone}}", actualIter.next().getText()) self.assertEqual("{{R:WordNet 2003|abalone}}", actualIter.next().getText()) self.assertFalse(actualIter.hasNext())
def testRelationsDescendantVaranda(self): # throws Exception page = self.parse("varanda.txt") entry = page.getEntry(0) iter_ = List(entry.getUnassignedSense().getRelations( RelationType.DESCENDANT)).iterator() self.assertRelation(RelationType.DESCENDANT, "Hindi: बरामदा", iter_.next()) self.assertRelation(RelationType.DESCENDANT, "Hindi: बरण्डा", iter_.next()) self.assertRelation(RelationType.DESCENDANT, "English: veranda", iter_.next()) self.assertRelation(RelationType.DESCENDANT, "English: verandah", iter_.next()) self.assertRelation(RelationType.DESCENDANT, "French: véranda", iter_.next()) self.assertFalse(iter_.hasNext())
def testSynonymsXray(self): # throws Exception page = self.parse("X-ray.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(2).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "Röntgen radiation", iter_.next()) self.assertRelation(RelationType.SYNONYM, "Rontgen radiation", iter_.next()) self.assertRelation(RelationType.SYNONYM, "Roentgen radiation", iter_.next()) self.assertRelation(RelationType.SYNONYM, "Röntgen rays", iter_.next()) self.assertRelation(RelationType.SYNONYM, "Rontgen rays", iter_.next()) self.assertRelation(RelationType.SYNONYM, "Roentgen rays", iter_.next()) self.assertRelation(RelationType.SYNONYM, "X-ray radiation", iter_.next()) self.assertFalse(iter_.hasNext())
def testSynonymsRainCatsAndDogs(self): # throws Exception page = self.parse("rain_cats_and_dogs.txt") entry = page.getEntry(0) iter_ = List(entry.getSense(1).getRelations( RelationType.SYNONYM)).iterator() self.assertRelation(RelationType.SYNONYM, "bucket", iter_.next()) self.assertRelation(RelationType.SYNONYM, "bucket down", iter_.next()) self.assertRelation(RelationType.SYNONYM, "chuck it down", iter_.next()) self.assertRelation(RelationType.SYNONYM, "rain buckets", iter_.next()) self.assertRelation(RelationType.SYNONYM, "rain pitchforks", iter_.next()) self.assertRelation(RelationType.SYNONYM, "pelt", iter_.next()) self.assertRelation(RelationType.SYNONYM, "piss down", iter_.next()) self.assertRelation(RelationType.SYNONYM, "pour", iter_.next()) self.assertRelation(RelationType.SYNONYM, "stream", iter_.next()) self.assertRelation(RelationType.SYNONYM, "teem", iter_.next()) self.assertFalse(iter_.hasNext())
def testHead(self): # throws Exception page = self.parse("head.txt") senseIter = List(page.getEntry(0).getSenses()).iterator() self.assertEqual( "{{countable}} The part of the [[body]] of an animal or human which contains the [[brain]], [[mouth]]{{,}} and main [[sense]] [[organs]].", senseIter.next().getGloss().getText()) self.assertEqual( "{{uncountable}} [[mental|Mental]] or [[emotional]] [[aptitude]] or [[skill]].", senseIter.next().getGloss().getText()) self.assertEqual( "{{countable}} [[mind|Mind]]; one's own [[thought]]s.", senseIter.next().getGloss().getText()) self.assertEqual( "{{countable}} The [[topmost]], [[foremost]], or [[leading]] part.", senseIter.next().getGloss().getText()) self.assertEqual( "The end of a rectangular [[table]] furthest from the entrance; traditionally considered a seat of honor.", senseIter.next().getGloss().getText()) self.assertEqual( "{{billiards}} The end of a [[pool]] table opposite the end where the balls have been [[rack]]ed.", senseIter.next().getGloss().getText()) self.assertEqual( "{{countable}} The [[principal]] [[operative]] part of a machine." + "\nThe end of a [[hammer]], [[axe]], {{soplink|golf|club}}{{,}} or similar [[implement]] used for striking other objects." + "\nThe end of a [[nail]], [[screw]], [[bolt]]{{,}} or similar [[fastener]] which is opposite the [[point]]; usually [[blunt]] and relatively [[wide]]." + "\nThe [[sharp]] end of an [[arrow]], [[spear]]{{,}} or [[pointer]]." + "\n{{lacrosse}} The top part of a [[lacrosse stick]] that holds the [[ball]].", senseIter.next().getGloss().getText()) self.assertEqual( "The [[source]] of a [[river]]; the end of a [[lake]] where a river flows into it.", senseIter.next().getGloss().getText()) self.assertEqual("{{rfc-sense}} The front, as of a [[queue]].", senseIter.next().getGloss().getText()) self.assertEqual("[[headway|Headway]]; [[progress]].", senseIter.next().getGloss().getText()) self.assertEqual( "The foam that forms on top of [[beer]] or other carbonated [[beverage]]s.", senseIter.next().getGloss().getText()) self.assertEqual( "{{countable}} [[leader|Leader]]; [[chief]]; [[mastermind]].", senseIter.next().getGloss().getText()) self.assertEqual("A [[headmaster]] or [[headmistress]].", senseIter.next().getGloss().getText()) self.assertEqual( "A [[headache]]; especially one resulting from [[intoxication]].", senseIter.next().getGloss().getText()) self.assertEqual( "A clump of [[leave]]s or [[flower]]s; a [[capitulum]].", senseIter.next().getGloss().getText()) self.assertEqual( "{{anatomy}} The rounded part of a bone fitting into a depression in another bone to form a ball-and-socket [[joint]].", senseIter.next().getGloss().getText()) self.assertEqual("An individual [[person]].", senseIter.next().getGloss().getText()) self.assertEqual( "{{uncountable|[[w:Measure word|measure word]] for [[livestock]] and [[game]]}} A single [[animal]].", senseIter.next().getGloss().getText()) self.assertEqual("The population of [[game]].", senseIter.next().getGloss().getText()) self.assertEqual("Topic; [[subject]].", senseIter.next().getGloss().getText()) self.assertEqual( "{{linguistics}} A [[morpheme]] that determines the category of a [[compound]] or the word that determines the [[syntactic]] type of the [[phrase]] of which it is a member.", senseIter.next().getGloss().getText()) self.assertEqual( "{{jazz}} The principal [[melody]] or [[theme]] of a piece.", senseIter.next().getGloss().getText()) self.assertEqual( "{{British|geology}} Deposits near the top of a [[geological]] [[succession]].", senseIter.next().getGloss().getText()) self.assertEqual( "{{medicine}} The end of an [[abscess]] where [[pus]] collects.", senseIter.next().getGloss().getText()) self.assertEqual("{{uncountable}} [[denouement]]; [[crisis]]", senseIter.next().getGloss().getText()) self.assertEqual( "A [[machine]] element which reads or writes [[electromagnetic]] signals to or from a storage medium.", senseIter.next().getGloss().getText()) self.assertEqual("{{music}} The [[headstock]] of a [[guitar]].", senseIter.next().getGloss().getText()) self.assertEqual( "{{music}} A [[drum head]], the [[membrane]] which is hit to produce [[sound]].", senseIter.next().getGloss().getText()) self.assertEqual( "{{engineering}} The end cap of a cylindrically-shaped [[pressure vessel]].", senseIter.next().getGloss().getText()) self.assertEqual( "{{automotive}} The [[cylinder head]], a platform above the [[cylinder]]s in an [[internal combustion engine]], containing the [[valve]]s and [[spark plug]]s.", senseIter.next().getGloss().getText()) self.assertEqual( "A buildup of [[fluid]] [[pressure]], often quantified as [[pressure head]].", senseIter.next().getGloss().getText()) self.assertEqual( "{{fluid dynamics}} The difference in [[elevation]] between two points in a [[column]] of fluid, and the resulting [[pressure]] of the fluid at the lower point.", senseIter.next().getGloss().getText()) self.assertEqual( "{{fluid dynamics}} More generally, [[energy]] in a mass of fluid divided by its [[weight]].", senseIter.next().getGloss().getText()) self.assertEqual("{{nautical}} The [[top]] edge of a [[sail]].", senseIter.next().getGloss().getText()) self.assertEqual("{{nautical}} The [[bow]] of a nautical vessel.", senseIter.next().getGloss().getText()) self.assertEqual("{{nautical}} The [[toilet]] of a [[ship]].", senseIter.next().getGloss().getText()) self.assertEqual( "{{uncountable|slang}} [[f******o|F******o]] or [[cunnilingus]]; [[oral sex]].", senseIter.next().getGloss().getText()) self.assertEqual("{{slang}} The [[glans penis]].", senseIter.next().getGloss().getText()) self.assertEqual( "{{countable|slang}} A heavy or [[habitual]] user of [[illicit]] [[drug]]s.", senseIter.next().getGloss().getText()) self.assertEqual("{{British}} A [[headland]].", senseIter.next().getGloss().getText()) self.assertFalse(senseIter.hasNext())
def __init__(self): """ Initializes the Wiktionary collection. """ self.editions = List()