def format_lexeme(lexical_entry, font): import output.tex as tex result = "" lexeme = font[VERNACULAR](handle_tilde( handle_tones(lexical_entry.get_lexeme()))) if lexical_entry.is_subentry(): result += "\\subparagraph{\\dollar\\blacksquare\\dollar " else: result += "\\paragraph{\\hspace{-0.5cm} " if lexical_entry.get_homonymNumber() is not None: # Add homonym number to lexeme lexeme += " \\textsubscript{" + str( lexical_entry.get_homonymNumber()) + "}" if lexical_entry.get_contextual_variations() is not None and len( lexical_entry.get_contextual_variations()) != 0: # Format contextual variations for var in lexical_entry.get_contextual_variations(): result += " " + font[VERNACULAR](handle_tilde(var)) result += " (from: " + lexeme + ")." else: # Format lexeme result += "{\Large " + lexeme + "}" result += "} \\hypertarget{" + tex.format_uid(lexical_entry, font) + "}{}" + EOL if not lexical_entry.is_subentry(): result += "\markboth{" + lexeme + "}{}" + EOL return result
def format_lexeme(lexical_entry, font): result = "" if len(lexical_entry.get_components()) != 0: lexeme = "" for component in lexical_entry.get_components(): lexeme += component.get_lexeme() + "," # Remove last punctuation lexeme = lexeme.rstrip(",") # Apply font # lexeme = font[VERNACULAR](lexeme) else: if lexical_entry.is_subentry(): lexeme = font[VERNACULAR](lexical_entry.get_lexeme()) else: lexeme = "" if lexical_entry.is_subentry(): # result += "\\subparagraph{\\dollar\\blacksquare\\dollar " # result += "\\begin{adjustwidth}{1em}{} " result += "\\begin{subentry}{" # print "totototototototototototototo" else: if len(lexical_entry.get_components()) != 0: result += "\\begin{entry}{" else: result += "\\begin{entry}{" + lexical_entry.get_lexeme() # + "}" # result += "\\vspace{0.5cm} \\paragraph{\\hspace{-0.5cm} " if lexical_entry.get_homonymNumber() is not None: # Add homonym number to lexeme lexeme += " \\textsubscript{" + str( lexical_entry.get_homonymNumber()) + "}" if lexical_entry.get_contextual_variations() is not None and len( lexical_entry.get_contextual_variations()) != 0: # Format contextual variations for var in lexical_entry.get_contextual_variations(): result += " " + font[VERNACULAR](var) result += " (de : " + lexeme + ")." else: # Format lexeme result += lexeme for form in lexical_entry.get_variant_forms(type="phonetics"): result += " / " + font[VERNACULAR](form) result += "} \\hypertarget{" + tex.format_uid(lexical_entry, font) + "}{}" + EOL if not lexical_entry.is_subentry(): # result += "\markboth{" + lexeme + "}{}" + EOL pass if len(lexical_entry.get_components()) != 0: # Add components part of speech result += "pc(" for component in lexical_entry.get_components(): if component.get_lexical_entry() is not None: result += tex.format_part_of_speech( component.get_lexical_entry(), font) result = result.rstrip(". ") + ", " # Handle last punctuation result = result.rstrip(", ") result += ("). ") return result
def format_lexeme(lexical_entry, font): import output.tex as tex result = "" inf_dev = font[NATIONAL](lexical_entry.get_citation_forms(script_name="devanagari")[0]) # lc_dev inf_api = font[VERNACULAR](lexical_entry.get_citation_forms(script_name="ipa")[0]) # lc root_api = font[VERNACULAR](lexical_entry.get_lexeme()) # lx if lexical_entry.is_subentry(): result += "\\subparagraph{\\dollar\\blacksquare\\dollar " else: result += "\\vspace{0.5cm} \\paragraph{\\hspace{-0.5cm} " if lexical_entry.get_homonymNumber() is not None: # Add homonym number to lexeme root_api += " \\textsubscript{" + str(lexical_entry.get_homonymNumber()) + "}" result += inf_dev + " " + inf_api + " (" + root_api + ")" result += "} \\hypertarget{" + tex.format_uid(lexical_entry, font) + "}{}" + EOL if not lexical_entry.is_subentry(): result += "\markboth{" + inf_dev + "}{}" + EOL return result
def format_lexeme(lexical_entry, font): result = "" if len(lexical_entry.get_components()) != 0: lexeme = "" for component in lexical_entry.get_components(): lexeme += component.get_lexeme() + "," # Remove last punctuation lexeme = lexeme.rstrip(",") # Apply font lexeme = font[VERNACULAR](lexeme) else: lexeme = font[VERNACULAR](lexical_entry.get_lexeme()) if lexical_entry.is_subentry(): result += "\\subparagraph{\\dollar\\blacksquare\\dollar " else: result += "\\vspace{0.5cm} \\paragraph{\\hspace{-0.5cm} " if lexical_entry.get_homonymNumber() is not None: # Add homonym number to lexeme lexeme += " \\textsubscript{" + str(lexical_entry.get_homonymNumber()) + "}" if lexical_entry.get_contextual_variations() is not None and len(lexical_entry.get_contextual_variations()) != 0: # Format contextual variations for var in lexical_entry.get_contextual_variations(): result += " " + font[VERNACULAR](var) result += " (de : " + lexeme + ")." else: # Format lexeme result += lexeme for form in lexical_entry.get_variant_forms(type = "phonetics"): result += " / " + font[VERNACULAR](form) result += "} \\hypertarget{" + tex.format_uid(lexical_entry, font) + "}{}" + EOL if not lexical_entry.is_subentry(): result += "\markboth{" + lexeme + "}{}" + EOL if len(lexical_entry.get_components()) != 0: # Add components part of speech result += "pc(" for component in lexical_entry.get_components(): if component.get_lexical_entry() is not None: result += tex.format_part_of_speech(component.get_lexical_entry(), font) result = result.rstrip(". ") + ", " # Handle last punctuation result = result.rstrip(", ") result += ("). ") return result
def format_lexeme(lexical_entry, font): import output.tex as tex result = "" inf_dev = font[NATIONAL](lexical_entry.get_citation_forms( script_name="devanagari")[0]) # lc_dev inf_api = font[VERNACULAR]( lexical_entry.get_citation_forms(script_name="ipa")[0]) # lc root_api = font[VERNACULAR](lexical_entry.get_lexeme()) # lx if lexical_entry.is_subentry(): result += "\\subparagraph{\\dollar\\blacksquare\\dollar " else: result += "\\vspace{0.5cm} \\paragraph{\\hspace{-0.5cm} " if lexical_entry.get_homonymNumber() is not None: # Add homonym number to lexeme root_api += " \\textsubscript{" + str( lexical_entry.get_homonymNumber()) + "}" result += inf_dev + " " + inf_api + " (" + root_api + ")" result += "} \\hypertarget{" + tex.format_uid(lexical_entry, font) + "}{}" + EOL if not lexical_entry.is_subentry(): result += "\markboth{" + inf_dev + "}{}" + EOL return result
def format_lexeme(lexical_entry, font): import output.tex as tex result = "" lexeme = font[VERNACULAR](handle_tilde(handle_tones(lexical_entry.get_lexeme()))) if lexical_entry.is_subentry(): result += "\\subparagraph{\\dollar\\blacksquare\\dollar " else: result += "\\paragraph{\\hspace{-0.5cm} " if lexical_entry.get_homonymNumber() is not None: # Add homonym number to lexeme lexeme += " \\textsubscript{" + str(lexical_entry.get_homonymNumber()) + "}" if lexical_entry.get_contextual_variations() is not None and len(lexical_entry.get_contextual_variations()) != 0: # Format contextual variations for var in lexical_entry.get_contextual_variations(): result += " " + font[VERNACULAR](handle_tilde(var)) result += " (from: " + lexeme + ")." else: # Format lexeme result += "{\Large " + lexeme + "}" result += "} \\hypertarget{" + tex.format_uid(lexical_entry, font) + "}{}" + EOL if not lexical_entry.is_subentry(): result += "\markboth{" + lexeme + "}{}" + EOL return result
def format_uid(lexical_entry, font): """Forbidden characters in filenames on Windows: < (less than) => none > (greater than) => none : (colon) => none " (double quote) => none / (forward slash) => none \ (backslash) => £ | (vertical bar; pipe) => € ? (question mark) => Q * (asterisk) => F """ import output.tex as tex text = "" if options.uid: text = tex.format_uid(lexical_entry, font) if text.find("|") != -1: text = text.replace('|', u"€") if text.find("?") != -1: text = text.replace('?', 'Q') if text.find("*") != -1: text = text.replace('*', 'F') text = " \\textcolor{red}{UID=" + text + "} " return text