Spaces:
Runtime error
Runtime error
Victoria Slocum
commited on
Commit
·
2e9de90
1
Parent(s):
db85c2c
NOT PRETTY
Browse files
app.py
CHANGED
|
@@ -172,21 +172,6 @@ with demo:
|
|
| 172 |
"## [Dependency Parser](https://spacy.io/usage/visualizers#dep)")
|
| 173 |
gr.Markdown(
|
| 174 |
"The dependency visualizer, `dep`, shows part-of-speech tags and syntactic dependencies.")
|
| 175 |
-
with gr.Row():
|
| 176 |
-
with gr.Column():
|
| 177 |
-
gr.Markdown("""```python
|
| 178 |
-
import spacy
|
| 179 |
-
from spacy import displacy
|
| 180 |
-
|
| 181 |
-
nlp = spacy.load("en_core_web_sm")
|
| 182 |
-
doc = nlp(text)
|
| 183 |
-
displacy.serve(doc, style="dep")
|
| 184 |
-
```
|
| 185 |
-
""")
|
| 186 |
-
with gr.Column():
|
| 187 |
-
gr.Markdown("")
|
| 188 |
-
with gr.Column():
|
| 189 |
-
gr.Markdown("")
|
| 190 |
with gr.Row():
|
| 191 |
with gr.Column():
|
| 192 |
col_punct = gr.Checkbox(
|
|
@@ -210,21 +195,6 @@ with demo:
|
|
| 210 |
"## [Entity Recognizer](https://spacy.io/usage/visualizers#ent)")
|
| 211 |
gr.Markdown(
|
| 212 |
"The entity visualizer, `ent`, highlights named entities and their labels in a text.")
|
| 213 |
-
with gr.Row():
|
| 214 |
-
with gr.Column():
|
| 215 |
-
gr.Markdown("""```python
|
| 216 |
-
import spacy
|
| 217 |
-
from spacy import displacy
|
| 218 |
-
|
| 219 |
-
nlp = spacy.load("en_core_web_sm")
|
| 220 |
-
doc = nlp(text)
|
| 221 |
-
displacy.serve(doc, style="ent")
|
| 222 |
-
```
|
| 223 |
-
""")
|
| 224 |
-
with gr.Column():
|
| 225 |
-
gr.Markdown("")
|
| 226 |
-
with gr.Column():
|
| 227 |
-
gr.Markdown("")
|
| 228 |
entity_input = gr.CheckboxGroup(
|
| 229 |
DEFAULT_ENTS, value=DEFAULT_ENTS)
|
| 230 |
entity_output = gr.HTML(value=entity(
|
|
@@ -250,7 +220,6 @@ with demo:
|
|
| 250 |
gr.Markdown(
|
| 251 |
"## [Word and Phrase Similarity](https://spacy.io/usage/linguistic-features#vectors-similarity)")
|
| 252 |
gr.Markdown("Words and spans have similarity ratings based off of their word vectors, or word embeddings")
|
| 253 |
-
gr.Markdown(">Word embeddings are multi-dimensional meaning representations of a word.")
|
| 254 |
with gr.Row():
|
| 255 |
with gr.Column():
|
| 256 |
sim_text1 = gr.Textbox(
|
|
@@ -270,26 +239,6 @@ with demo:
|
|
| 270 |
gr.Markdown(
|
| 271 |
"## [Spans](https://spacy.io/usage/visualizers#span)")
|
| 272 |
gr.Markdown("The span visualizer, `span`, highlights overlapping spans in a text.")
|
| 273 |
-
with gr.Row():
|
| 274 |
-
with gr.Column():
|
| 275 |
-
gr.Markdown("""```python
|
| 276 |
-
import spacy
|
| 277 |
-
from spacy import displacy
|
| 278 |
-
from spacy.tokens import Span
|
| 279 |
-
|
| 280 |
-
nlp = spacy.load("en_core_web_sm")
|
| 281 |
-
doc = nlp(text)
|
| 282 |
-
doc.spans["sc"] = [
|
| 283 |
-
Span(doc, 6, 8, "ORG")
|
| 284 |
-
Span(doc, 6, 7, "GPE")
|
| 285 |
-
]
|
| 286 |
-
displacy.serve(doc, style="span")
|
| 287 |
-
```
|
| 288 |
-
""")
|
| 289 |
-
with gr.Column():
|
| 290 |
-
gr.Markdown("")
|
| 291 |
-
with gr.Column():
|
| 292 |
-
gr.Markdown("")
|
| 293 |
with gr.Column():
|
| 294 |
with gr.Row():
|
| 295 |
with gr.Column():
|
|
|
|
| 172 |
"## [Dependency Parser](https://spacy.io/usage/visualizers#dep)")
|
| 173 |
gr.Markdown(
|
| 174 |
"The dependency visualizer, `dep`, shows part-of-speech tags and syntactic dependencies.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
with gr.Row():
|
| 176 |
with gr.Column():
|
| 177 |
col_punct = gr.Checkbox(
|
|
|
|
| 195 |
"## [Entity Recognizer](https://spacy.io/usage/visualizers#ent)")
|
| 196 |
gr.Markdown(
|
| 197 |
"The entity visualizer, `ent`, highlights named entities and their labels in a text.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
entity_input = gr.CheckboxGroup(
|
| 199 |
DEFAULT_ENTS, value=DEFAULT_ENTS)
|
| 200 |
entity_output = gr.HTML(value=entity(
|
|
|
|
| 220 |
gr.Markdown(
|
| 221 |
"## [Word and Phrase Similarity](https://spacy.io/usage/linguistic-features#vectors-similarity)")
|
| 222 |
gr.Markdown("Words and spans have similarity ratings based off of their word vectors, or word embeddings")
|
|
|
|
| 223 |
with gr.Row():
|
| 224 |
with gr.Column():
|
| 225 |
sim_text1 = gr.Textbox(
|
|
|
|
| 239 |
gr.Markdown(
|
| 240 |
"## [Spans](https://spacy.io/usage/visualizers#span)")
|
| 241 |
gr.Markdown("The span visualizer, `span`, highlights overlapping spans in a text.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
with gr.Column():
|
| 243 |
with gr.Row():
|
| 244 |
with gr.Column():
|