def hebrew_term(s): from sefaria.model import library from sefaria.system.exceptions import BookNameError if is_hebrew(s): return s term = library.get_simple_term_mapping().get(s) if term: return term["he"] else: try: # If s is a text title, look for a stored Hebrew title i = library.get_index(s) return i.get_title("he") except BookNameError: return ''
def hebrew_term(s): from sefaria.model import library, IndexSet, Term from sefaria.system.exceptions import BookNameError if is_hebrew(s): return s term = library.get_simple_term_mapping().get(s) if term: return term["he"] else: try: # If s is a text title, look for a stored Hebrew title i = library.get_index(s) return i.get_title("he") except BookNameError: return ''
def hebrew_parasha_name(value): """ Returns a Hebrew ref for the english ref passed in. """ from sefaria.model import Term, library if not value: return "" if "-" in value: if value == "Lech-Lecha": return hebrew_parasha_name(value.replace("-", " ")) else: names = value.split("-") return ("-").join(map(hebrew_parasha_name, names)) else: try: parasha = library.get_simple_term_mapping().get(value)["he"] except Exception as e: logger.error(e.message) parasha = value return parasha
def terms(request): return {"terms_json": json.dumps(library.get_simple_term_mapping())}