def toRDF(self, graph): wordform = self.getIri() wordformHeb = self.getHebIri() hebString = lat2heb(self.wordform) graph.add((wordform, RDF.type, mmoon_heb.Wordform)) graph.add((wordform, RDFS.label, rdflib.term.Literal(self.wordform))) graph.add((wordform, RDFS.label, rdflib.term.Literal(lat2heb(self.wordform), lang="he"))) graph.add((wordform, mmoon.consistsOfRoot, self.root.getIri())) graph.add((wordform, mmoon.consistsOfTransfix, self.transfix.getIri())) graph.add((wordformHeb, RDF.type, mmoon_heb.Wordform)) graph.add((wordformHeb, OWL.sameAs, wordform)) graph.add( (wordformHeb, RDFS.label, rdflib.term.Literal(hebString, lang="he")))
def toRDF(self, graph): # TODO use heb2lat root = self.getIri() rootHeb = self.getHebIri() hebString = lat2heb(self.root) graph.add((root, RDF.type, mmoon_heb.Root)) graph.add((root, RDFS.label, rdflib.term.Literal(self.root))) graph.add((root, RDFS.label, rdflib.term.Literal(hebString, lang="he"))) graph.add((rootHeb, RDF.type, mmoon_heb.Root)) graph.add((rootHeb, OWL.sameAs, root)) graph.add( (rootHeb, RDFS.label, rdflib.term.Literal(hebString, lang="he")))
def toRDF(self, graph): # TODO use heb2lat transfix = self.getIri() transfixHeb = self.getHebIri() hebString = lat2heb(self.transfix) graph.add((transfix, RDF.type, mmoon_heb.Transfix)) graph.add((transfix, RDFS.label, rdflib.term.Literal(self.transfix))) graph.add( (transfix, RDFS.label, rdflib.term.Literal(hebString, lang="he"))) graph.add((transfix, mmoon.correspondsToMorpheme, self.morpheme)) graph.add((self.morpheme, mmoon.hasRealization, transfix)) graph.add((transfixHeb, RDF.type, mmoon_heb.Transfix)) graph.add((transfixHeb, OWL.sameAs, transfix)) graph.add( (transfixHeb, RDFS.label, rdflib.term.Literal(hebString, lang="he")))
def toRDF(self, graph): # TODO use heb2lat lexeme = rdflib.term.URIRef(heb_inventory + "Lexeme_" + self.lexeme) hebString = lat2heb(self.lexeme) lexemeHeb = rdflib.term.URIRef(heb_inventory + "Lexeme_" + hebString) graph.add((lexeme, RDF.type, mmoon_heb.Lexeme)) graph.add((lexeme, RDFS.label, rdflib.term.Literal(self.lexeme))) graph.add((lexeme, RDFS.label, rdflib.term.Literal(hebString, lang="he"))) graph.add((lexeme, mmoon.hasWordclassAffiliation, self.wordClass)) graph.add((lexeme, mmoon.hasMorphologicalRelationship, self.binjan)) graph.add((lexemeHeb, RDF.type, mmoon_heb.Lexeme)) graph.add((lexemeHeb, OWL.sameAs, lexeme)) graph.add( (lexemeHeb, RDFS.label, rdflib.term.Literal(hebString, lang="he"))) # TODO add representations for wordform in self.wordforms: graph.add((lexeme, mmoon.hasWordform, wordform.getIri())) graph.add((wordform.getIri(), mmoon.belongsToLexeme, lexeme))
def getHebIri(self): heb = lat2heb(self.root) return rdflib.term.URIRef(heb_inventory + "Root_" + heb)
def getHebIri(self): heb = lat2heb(self.wordform) return rdflib.term.URIRef(heb_inventory + "Wordform_" + heb)
def getHebIri(self): heb = lat2heb(self.transfix) return rdflib.term.URIRef(heb_inventory + "Transfix_" + heb)
#!/usr/bin/python3 import heb2lat text = "hallo äöü ÄÖÜ HALLO לכד אָכּלֻץ אָאּגּהּ ְ ◌ שׁ שׂ ש" text2 = "Schulter כָּתֵף" text2 = "דבר" trans = heb2lat.heb2lat(text) print("\n") trans2 = heb2lat.heb2lat(text2) print(text) print(trans) print(text2) print(trans2) lat1 = heb2lat.heb2lat("בִּשַּׁלְתִּי") heb1 = heb2lat.lat2heb("B8iV1aLmF8iJ-") print(lat1) print(heb1) heb2 = heb2lat.lat2heb("D8iB8mRtH-") print(heb2)