onurkeles commited on
Commit
35edc67
1 Parent(s): 51c5ebd

Update pos_tagger.py

Browse files
Files changed (1) hide show
  1. pos_tagger.py +9 -9
pos_tagger.py CHANGED
@@ -14,7 +14,7 @@ def tag_pos(text, detailed_output):
14
  if detailed_output:
15
  # Generate detailed information with tag values and probabilities
16
  output = []
17
- for label in sentence.get_labels('pos'):
18
  output.append(
19
  f"{label.data_point.text}: {label.value} ({label.score:.2f})"
20
  )
@@ -38,16 +38,15 @@ def write():
38
  help="If checked, output shows detailed tag information (probability scores, etc.).",
39
  )
40
 
41
-
42
- # Input text area, pre-populated with current input text if available
43
  input_text = st.text_area("Enter a text:", height=100, value=st.session_state.get('input_text', 'Put example text here.'))
44
-
45
  if st.button("Tag POS", key="tag_pos"):
46
  with st.spinner('Processing...'):
47
  output = tag_pos(input_text, detailed_output)
48
  st.success(output)
49
 
50
- # Example Sentences and Translations
51
  example_sentences = [
52
  ("tuute acertsetser topoldetser.", "Kâğıdı büzüştürdün attın. Oldu mu?"),
53
  ("Baran u Baden teran.", "Baran ve Bade koştu."),
@@ -55,11 +54,12 @@ def write():
55
  ]
56
 
57
  st.write("## Example Sentences:")
58
-
59
  for hamshetsnag, turkish in example_sentences:
60
  if st.button(f"Use: {hamshetsnag}", key=hamshetsnag):
61
- st.session_state['input_text'] = hamshetsnag # Update input text in session state
62
- break # Stop checking further examples once one is used
 
 
63
 
64
- st.write(f"(TR: {turkish})") # Show the translation as a comment, but not clickable
65
 
 
14
  if detailed_output:
15
  # Generate detailed information with tag values and probabilities
16
  output = []
17
+ for label in sentence.get_labels():
18
  output.append(
19
  f"{label.data_point.text}: {label.value} ({label.score:.2f})"
20
  )
 
38
  help="If checked, output shows detailed tag information (probability scores, etc.).",
39
  )
40
 
41
+ # Input text area
 
42
  input_text = st.text_area("Enter a text:", height=100, value=st.session_state.get('input_text', 'Put example text here.'))
43
+
44
  if st.button("Tag POS", key="tag_pos"):
45
  with st.spinner('Processing...'):
46
  output = tag_pos(input_text, detailed_output)
47
  st.success(output)
48
 
49
+ # Example Sentences and Translations
50
  example_sentences = [
51
  ("tuute acertsetser topoldetser.", "Kâğıdı büzüştürdün attın. Oldu mu?"),
52
  ("Baran u Baden teran.", "Baran ve Bade koştu."),
 
54
  ]
55
 
56
  st.write("## Example Sentences:")
57
+
58
  for hamshetsnag, turkish in example_sentences:
59
  if st.button(f"Use: {hamshetsnag}", key=hamshetsnag):
60
+ st.session_state['input_text'] = hamshetsnag # Update input text
61
+ break
62
+
63
+ st.write(f"(TR: {turkish})") # Display translation as plain text
64
 
 
65