awacke1 commited on
Commit
612baf2
·
1 Parent(s): 59d30fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -23,8 +23,8 @@ physics = st.sidebar.checkbox('Add physics interactivity?')
23
  def draw_knowledge_graph(file_contents, physics):
24
  # Extract sentences and emojis from the file
25
  sentences = re.split(r'\n', file_contents)
26
- # emojis_list = [emoji.emojize(x) for x in emoji.UNICODE_EMOJI['en']]
27
- # emojis = [ch for ch in file_contents if ch in emojis_list]
28
 
29
  # Create a graph
30
  G = nx.Graph()
@@ -36,7 +36,7 @@ def draw_knowledge_graph(file_contents, physics):
36
  for j, other_sentence in enumerate(sentences[:idx]):
37
  other_words = set(other_sentence.lower().split())
38
  common_words = words & other_words
39
- # common_emojis = set(emojis) & set(sentence) & set(other_sentence)
40
  if common_words: # or common_emojis
41
  G.add_edge(idx, j, weight=len(common_words) + len(common_emojis))
42
 
 
23
  def draw_knowledge_graph(file_contents, physics):
24
  # Extract sentences and emojis from the file
25
  sentences = re.split(r'\n', file_contents)
26
+ emojis_list = [emoji.emojize(x) for x in emoji.UNICODE_EMOJI['en']]
27
+ emojis = [ch for ch in file_contents if ch in emojis_list]
28
 
29
  # Create a graph
30
  G = nx.Graph()
 
36
  for j, other_sentence in enumerate(sentences[:idx]):
37
  other_words = set(other_sentence.lower().split())
38
  common_words = words & other_words
39
+ common_emojis = set(emojis) & set(sentence) & set(other_sentence)
40
  if common_words: # or common_emojis
41
  G.add_edge(idx, j, weight=len(common_words) + len(common_emojis))
42