cdleong commited on
Commit
9989672
1 Parent(s): 5d305df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -2,6 +2,7 @@ import streamlit as st
2
  import langcodes
3
 
4
  # https://huggingface.co/blog/streamlit-spaces
 
5
  langtext = st.text_input("language lookup using https://github.com/rspeer/langcodes, see also https://r12a.github.io/app-subtags/", "english")
6
 
7
  st.write("Checking whether the tag is valid. That is, the language, script, territory, and variants (if present) are all tags that have meanings assigned by IANA.")
@@ -40,6 +41,7 @@ def pull_obsolete_codes(iso_code):
40
  from requests_html import HTMLSession
41
  session = HTMLSession()
42
  r= session.get(f"https://iso639-3.sil.org/code/{iso_code}")
 
43
  for found_element in r.html.find(".views-field-nothing", clean=True):
44
  lines = found_element.text.splitlines()
45
  # lines = text.splitlines()
@@ -80,7 +82,7 @@ if lang is not None:
80
 
81
  broader_tags = lang.broader_tags()
82
  st.write(f"Broader tags for this language, if any: {broader_tags}")
83
- st.write(f"Correct, standardized, BCP-47 tag for {langtext}, according to the langcodes library: {langcodes.standardize_tag(lang)}")
84
  st.write(f"Try also: https://r12a.github.io/app-subtags/?lookup={lang}")
85
  st.write(f"https://glottolog.org/glottolog?search={t_variant} may be of interest, with links to Ethnologue, etc. If that doesn't work, try https://glottolog.org/glottolog?search={b_variant}")
 
86
 
2
  import langcodes
3
 
4
  # https://huggingface.co/blog/streamlit-spaces
5
+ # https://github.com/psf/requests-html
6
  langtext = st.text_input("language lookup using https://github.com/rspeer/langcodes, see also https://r12a.github.io/app-subtags/", "english")
7
 
8
  st.write("Checking whether the tag is valid. That is, the language, script, territory, and variants (if present) are all tags that have meanings assigned by IANA.")
41
  from requests_html import HTMLSession
42
  session = HTMLSession()
43
  r= session.get(f"https://iso639-3.sil.org/code/{iso_code}")
44
+ # https://www.w3schools.com/cssref/css_selectors.asp
45
  for found_element in r.html.find(".views-field-nothing", clean=True):
46
  lines = found_element.text.splitlines()
47
  # lines = text.splitlines()
82
 
83
  broader_tags = lang.broader_tags()
84
  st.write(f"Broader tags for this language, if any: {broader_tags}")
 
85
  st.write(f"Try also: https://r12a.github.io/app-subtags/?lookup={lang}")
86
  st.write(f"https://glottolog.org/glottolog?search={t_variant} may be of interest, with links to Ethnologue, etc. If that doesn't work, try https://glottolog.org/glottolog?search={b_variant}")
87
+ st.write(f"Correct, standardized, BCP-47 tag for {langtext}, according to the langcodes library: {langcodes.standardize_tag(lang)}")
88