Closed Fourthought closed 2 years ago
Hi @Fourthought, my guess is that you may need to ensure the file explacy.py
is in the same directory that you're running Jupyter from. Python will look both in the local directory as well as in some key import directories when it executes an import
statement.
I'm going to close this issue because I don't think this is something to be addressed within the explacy repo. But if you have more questions please feel free to ask them here and maybe I can help. (Sorry for replying slowly!)
Hi, Tyler. nice to meet you. I've some problems to install. I've tried thislike on command.
pip install explacy
but, I got following ERROR.
ERROR: Could not find a version that satisfies the requirement explacy (from versions: none) ERROR: No matching distribution found for explacy
Hi @greybraun ! Nice to meet you, too!
Right now this is not a pip
-installable package. It's just a single Python file, so a simple way to use it is to download that one Python file into the same directory you'd like to use it from and include import explacy
in your program.
Thanks. But, following code takes some error.
explacy.print_parse_info(spacy_tok, 'The salad was surprisingly tasty.')
AttributeError: module 'explacy' has no attribute
'print_parse_info'
On Mon, Oct 10, 2022 at 1:52 PM Tyler Neylon @.***> wrote:
Hi @greybraun https://github.com/greybraun ! Nice to meet you, too!
Right now this is not a pip-installable package. It's just a single Python file, so a simple way to use it is to download that one Python file into the same directory you'd like to use it from and include import explacy in your program.
— Reply to this email directly, view it on GitHub https://github.com/tylerneylon/explacy/issues/2#issuecomment-1272784972, or unsubscribe https://github.com/notifications/unsubscribe-auth/A27U4IHI2F2ACAPVXQPCRE3WCOOIRANCNFSM4HXJRCFQ . You are receiving this because you were mentioned.Message ID: @.***>
Hi @greybraun, can you try this example, and see what happens?
import spacy
import explacy
nlp = spacy.load("en_core_web_sm")
sentence = 'The github issue was resolved with stunning alacrity.'
explacy.print_parse_info(nlp, sentence)
Thanks It works. But I want to know How does your code work? thank you.
On Tue, Oct 11, 2022 at 7:13 AM Tyler Neylon @.***> wrote:
Hi @greybraun https://github.com/greybraun, can you try this example, and see what happens?
import spacy import explacy
nlp = spacy.load("en_core_web_sm") sentence = 'The github issue was resolved with stunning alacrity.' explacy.print_parse_info(nlp, sentence)
— Reply to this email directly, view it on GitHub https://github.com/tylerneylon/explacy/issues/2#issuecomment-1273863308, or unsubscribe https://github.com/notifications/unsubscribe-auth/A27U4IEX5S3RDWLOFC5SY5TWCSIHPANCNFSM4HXJRCFQ . You are receiving this because you were mentioned.Message ID: @.***>
The hard work of understanding the natural language of the sentence is all done by spacy.
What explacy does is to understand how to render the dependency tree in text characters. It does this by figuring out which arrows need to be "above" others (in reality, the "higher" arrows are drawn farther to the left).
If you'd like to understand the rendering itself in more detail, you can edit explacy.py
to set the internal variable _do_print_debug_info
to True
, and this will provide you a lot of intermediate data to see how the code thinks. It's also of course useful to simply read the code itself.
Here is sample output for the above sentence ("The github issue was resolved with stunning alacrity."), including the extra debugging data:
Arrow 0: "issue" -> "The"
0 is over 1
Arrow 1: "issue" -> "github"
Arrow 2: "resolved" -> "issue"
2 is over 0
2 is over 1
2 is over 3
Arrow 3: "resolved" -> "was"
Arrow 4: "resolved" -> "with"
4 is over 6
Arrow 5: "resolved" -> "."
5 is over 4
5 is over 6
5 is over 7
Arrow 6: "with" -> "alacrity"
6 is over 7
Arrow 7: "alacrity" -> "stunning"
arrows:
[{'from': issue, 'num_deps': 1, 'num_deps_left': 1, 'to': The, 'underset': {1}},
{'from': issue,
'num_deps': 0,
'num_deps_left': 0,
'to': github,
'underset': set()},
{'from': resolved,
'num_deps': 3,
'num_deps_left': 3,
'to': issue,
'underset': {0, 1, 3}},
{'from': resolved,
'num_deps': 0,
'num_deps_left': 0,
'to': was,
'underset': set()},
{'from': resolved,
'num_deps': 1,
'num_deps_left': 1,
'to': with,
'underset': {6}},
{'from': resolved,
'num_deps': 3,
'num_deps_left': 3,
'to': .,
'underset': {4, 6, 7}},
{'from': with,
'num_deps': 1,
'num_deps_left': 1,
'to': alacrity,
'underset': {7}},
{'from': alacrity,
'num_deps': 0,
'num_deps_left': 0,
'to': stunning,
'underset': set()}]
arrows_with_deps:
defaultdict(<class 'set'>, {1: {0, 4, 6}, 0: {1, 3, 7}, 3: {2, 5}})
Rendering arrow 1: "issue" -> "github"
height = 3
Rendering arrow 3: "resolved" -> "was"
height = 3
Rendering arrow 7: "alacrity" -> "stunning"
height = 3
Rendering arrow 0: "issue" -> "The"
height = 4
Rendering arrow 2: "resolved" -> "issue"
height = 7
Rendering arrow 6: "with" -> "alacrity"
height = 6
Rendering arrow 4: "resolved" -> "with"
height = 9
Rendering arrow 5: "resolved" -> "."
height = 10
Dep tree Token Dep type Lemma Part of Sp
────────── ──────── ───────── ──────── ──────────
┌──► The det the DET
│┌─► github compound github NOUN
┌─►└┴── issue nsubjpass issue NOUN
│ ┌─► was auxpass be AUX
┌┬─┴───┴── resolved ROOT resolve VERB
│└─►┌───── with prep with ADP
│ │ ┌─► stunning amod stunning ADJ
│ └─►└── alacrity pobj alacrity NOUN
└────────► . punct . PUNCT
Awesome, thanks!
On Wed, Oct 12, 2022 at 1:02 AM Tyler Neylon @.***> wrote:
The hard work of understanding the natural language of the sentence is all done by spacy.
What explacy does is to understand how to render the dependency tree in text characters. It does this by figuring out which arrows need to be "above" others (in reality, the "higher" arrows are drawn farther to the left).
If you'd like to understand the rendering itself in more detail, you can edit explacy.py to set the internal variable _do_print_debug_info to True, and this will provide you a lot of intermediate data to see how the code thinks. It's also of course useful to simply read the code itself https://github.com/tylerneylon/explacy/blob/master/explacy.py.
Here is sample output for the above sentence ("The github issue was resolved with stunning alacrity."), including the extra debugging data:
Arrow 0: "issue" -> "The"
0 is over 1
Arrow 1: "issue" -> "github"
Arrow 2: "resolved" -> "issue"
2 is over 0
2 is over 1
2 is over 3
Arrow 3: "resolved" -> "was"
Arrow 4: "resolved" -> "with"
4 is over 6
Arrow 5: "resolved" -> "."
5 is over 4
5 is over 6
5 is over 7
Arrow 6: "with" -> "alacrity"
6 is over 7
Arrow 7: "alacrity" -> "stunning"
arrows:
[{'from': issue, 'num_deps': 1, 'num_deps_left': 1, 'to': The, 'underset': {1}},
{'from': issue,
'num_deps': 0,
'num_deps_left': 0,
'to': github,
'underset': set()},
{'from': resolved,
'num_deps': 3,
'num_deps_left': 3,
'to': issue,
'underset': {0, 1, 3}},
{'from': resolved,
'num_deps': 0,
'num_deps_left': 0,
'to': was,
'underset': set()},
{'from': resolved,
'num_deps': 1,
'num_deps_left': 1,
'to': with,
'underset': {6}},
{'from': resolved,
'num_deps': 3,
'num_deps_left': 3,
'to': .,
'underset': {4, 6, 7}},
{'from': with,
'num_deps': 1,
'num_deps_left': 1,
'to': alacrity,
'underset': {7}},
{'from': alacrity,
'num_deps': 0,
'num_deps_left': 0,
'to': stunning,
'underset': set()}]
arrows_with_deps:
defaultdict(<class 'set'>, {1: {0, 4, 6}, 0: {1, 3, 7}, 3: {2, 5}})
Rendering arrow 1: "issue" -> "github"
height = 3
Rendering arrow 3: "resolved" -> "was"
height = 3
Rendering arrow 7: "alacrity" -> "stunning"
height = 3
Rendering arrow 0: "issue" -> "The"
height = 4
Rendering arrow 2: "resolved" -> "issue"
height = 7
Rendering arrow 6: "with" -> "alacrity"
height = 6
Rendering arrow 4: "resolved" -> "with"
height = 9
Rendering arrow 5: "resolved" -> "."
height = 10
Dep tree Token Dep type Lemma Part of Sp
────────── ──────── ───────── ──────── ──────────
┌──► The det the DET │┌─► github compound github NOUN
┌─►└┴── issue nsubjpass issue NOUN
│ ┌─► was auxpass be AUX
┌┬─┴───┴── resolved ROOT resolve VERB
│└─►┌───── with prep with ADP
│ │ ┌─► stunning amod stunning ADJ
│ └─►└── alacrity pobj alacrity NOUN
└────────► . punct . PUNCT
— Reply to this email directly, view it on GitHub https://github.com/tylerneylon/explacy/issues/2#issuecomment-1274931648, or unsubscribe https://github.com/notifications/unsubscribe-auth/A27U4IERPIP3TKB2VPKE433WCWFRDANCNFSM4HXJRCFQ . You are receiving this because you were mentioned.Message ID: @.***>
Thank you very much. How can I recommend you to NET? Now, I want that. And excuse me, I've one question. I'm training my pipeline(exaactly, "textcat" component), and I've got unknown error and google hasn't suitable answer. plz help me. Code is following, for batch in batches: for text, annotation in batch: doc = nlp.make_doc(text) example = Example.from_dict(doc, annotation) nlp.update([example], losses = losses, drop = 0.3) and I've got this error.(I think training data is correct.) Exception has occurred: ValueError
Cannot get dimension 'nO' for model 'sparse_linear': value unset
On Wed, Oct 12, 2022 at 2:03 AM Grey Braun @.***> wrote:
Awesome, thanks!
On Wed, Oct 12, 2022 at 1:02 AM Tyler Neylon @.***> wrote:
The hard work of understanding the natural language of the sentence is all done by spacy.
What explacy does is to understand how to render the dependency tree in text characters. It does this by figuring out which arrows need to be "above" others (in reality, the "higher" arrows are drawn farther to the left).
If you'd like to understand the rendering itself in more detail, you can edit explacy.py to set the internal variable _do_print_debug_info to True, and this will provide you a lot of intermediate data to see how the code thinks. It's also of course useful to simply read the code itself.
Here is sample output for the above sentence ("The github issue was resolved with stunning alacrity."), including the extra debugging data:
Arrow 0: "issue" -> "The"
0 is over 1
Arrow 1: "issue" -> "github"
Arrow 2: "resolved" -> "issue"
2 is over 0
2 is over 1
2 is over 3
Arrow 3: "resolved" -> "was"
Arrow 4: "resolved" -> "with"
4 is over 6
Arrow 5: "resolved" -> "."
5 is over 4
5 is over 6
5 is over 7
Arrow 6: "with" -> "alacrity"
6 is over 7
Arrow 7: "alacrity" -> "stunning"
arrows:
[{'from': issue, 'num_deps': 1, 'num_deps_left': 1, 'to': The, 'underset': {1}},
{'from': issue,
'num_deps': 0,
'num_deps_left': 0,
'to': github,
'underset': set()},
{'from': resolved,
'num_deps': 3,
'num_deps_left': 3,
'to': issue,
'underset': {0, 1, 3}},
{'from': resolved,
'num_deps': 0,
'num_deps_left': 0,
'to': was,
'underset': set()},
{'from': resolved,
'num_deps': 1,
'num_deps_left': 1,
'to': with,
'underset': {6}},
{'from': resolved,
'num_deps': 3,
'num_deps_left': 3,
'to': .,
'underset': {4, 6, 7}},
{'from': with,
'num_deps': 1,
'num_deps_left': 1,
'to': alacrity,
'underset': {7}},
{'from': alacrity,
'num_deps': 0,
'num_deps_left': 0,
'to': stunning,
'underset': set()}]
arrows_with_deps:
defaultdict(<class 'set'>, {1: {0, 4, 6}, 0: {1, 3, 7}, 3: {2, 5}})
Rendering arrow 1: "issue" -> "github"
height = 3
Rendering arrow 3: "resolved" -> "was"
height = 3
Rendering arrow 7: "alacrity" -> "stunning"
height = 3
Rendering arrow 0: "issue" -> "The"
height = 4
Rendering arrow 2: "resolved" -> "issue"
height = 7
Rendering arrow 6: "with" -> "alacrity"
height = 6
Rendering arrow 4: "resolved" -> "with"
height = 9
Rendering arrow 5: "resolved" -> "."
height = 10
Dep tree Token Dep type Lemma Part of Sp
────────── ──────── ───────── ──────── ──────────
┌──► The det the DET │┌─► github compound github NOUN
┌─►└┴── issue nsubjpass issue NOUN
│ ┌─► was auxpass be AUX
┌┬─┴───┴── resolved ROOT resolve VERB
│└─►┌───── with prep with ADP
│ │ ┌─► stunning amod stunning ADJ
│ └─►└── alacrity pobj alacrity NOUN
└────────► . punct . PUNCT
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
Hi greybaun, sorry, this is outside the scope of explacy! I'm going to keep my focus in this repo on this codebase. I hope you're able to find an answer to your question, though!
Thank you very much. And excuse me, I've one question. I'm training my pipeline(exaactly, "textcat" component), and I've got unknown error and google hasn't suitable answer. plz help me. Code is following, for batch in batches: for text, annotation in batch: doc = nlp.make_doc(text) example = Example.from_dict(doc, annotation) nlp.update([example], losses = losses, drop = 0.3) and I've got this error.(I think training data is correct.) Exception has occurred: ValueError
Cannot get dimension 'nO' for model 'sparse_linear': value unset
On Wed, Oct 12, 2022 at 2:14 AM Grey Braun @.***> wrote:
Thank you very much. How can I recommend you to NET? Now, I want that. And excuse me, I've one question. I'm training my pipeline(exaactly, "textcat" component), and I've got unknown error and google hasn't suitable answer. plz help me. Code is following, for batch in batches: for text, annotation in batch: doc = nlp.make_doc(text) example = Example.from_dict(doc, annotation) nlp.update([example], losses = losses, drop = 0.3) and I've got this error.(I think training data is correct.) Exception has occurred: ValueError
Cannot get dimension 'nO' for model 'sparse_linear': value unset
On Wed, Oct 12, 2022 at 2:03 AM Grey Braun @.***> wrote:
Awesome, thanks!
On Wed, Oct 12, 2022 at 1:02 AM Tyler Neylon @.***> wrote:
The hard work of understanding the natural language of the sentence is all done by spacy.
What explacy does is to understand how to render the dependency tree in text characters. It does this by figuring out which arrows need to be "above" others (in reality, the "higher" arrows are drawn farther to the left).
If you'd like to understand the rendering itself in more detail, you can edit explacy.py to set the internal variable _do_print_debug_info to True, and this will provide you a lot of intermediate data to see how the code thinks. It's also of course useful to simply read the code itself.
Here is sample output for the above sentence ("The github issue was resolved with stunning alacrity."), including the extra debugging data:
Arrow 0: "issue" -> "The"
0 is over 1
Arrow 1: "issue" -> "github"
Arrow 2: "resolved" -> "issue"
2 is over 0
2 is over 1
2 is over 3
Arrow 3: "resolved" -> "was"
Arrow 4: "resolved" -> "with"
4 is over 6
Arrow 5: "resolved" -> "."
5 is over 4
5 is over 6
5 is over 7
Arrow 6: "with" -> "alacrity"
6 is over 7
Arrow 7: "alacrity" -> "stunning"
arrows:
[{'from': issue, 'num_deps': 1, 'num_deps_left': 1, 'to': The, 'underset': {1}},
{'from': issue,
'num_deps': 0,
'num_deps_left': 0,
'to': github,
'underset': set()},
{'from': resolved,
'num_deps': 3,
'num_deps_left': 3,
'to': issue,
'underset': {0, 1, 3}},
{'from': resolved,
'num_deps': 0,
'num_deps_left': 0,
'to': was,
'underset': set()},
{'from': resolved,
'num_deps': 1,
'num_deps_left': 1,
'to': with,
'underset': {6}},
{'from': resolved,
'num_deps': 3,
'num_deps_left': 3,
'to': .,
'underset': {4, 6, 7}},
{'from': with,
'num_deps': 1,
'num_deps_left': 1,
'to': alacrity,
'underset': {7}},
{'from': alacrity,
'num_deps': 0,
'num_deps_left': 0,
'to': stunning,
'underset': set()}]
arrows_with_deps:
defaultdict(<class 'set'>, {1: {0, 4, 6}, 0: {1, 3, 7}, 3: {2, 5}})
Rendering arrow 1: "issue" -> "github"
height = 3
Rendering arrow 3: "resolved" -> "was"
height = 3
Rendering arrow 7: "alacrity" -> "stunning"
height = 3
Rendering arrow 0: "issue" -> "The"
height = 4
Rendering arrow 2: "resolved" -> "issue"
height = 7
Rendering arrow 6: "with" -> "alacrity"
height = 6
Rendering arrow 4: "resolved" -> "with"
height = 9
Rendering arrow 5: "resolved" -> "."
height = 10
Dep tree Token Dep type Lemma Part of Sp
────────── ──────── ───────── ──────── ──────────
┌──► The det the DET │┌─► github compound github NOUN
┌─►└┴── issue nsubjpass issue NOUN
│ ┌─► was auxpass be AUX
┌┬─┴───┴── resolved ROOT resolve VERB
│└─►┌───── with prep with ADP
│ │ ┌─► stunning amod stunning ADJ
│ └─►└── alacrity pobj alacrity NOUN
└────────► . punct . PUNCT
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
Hi Tyler,
Really looking forward to using Explacy, however, being new to computer science I don't seem to be able to install the module using the provided instructions.
Have downloaded using the wget command, but don't seem to be able to import, would you be able to assist with a more basic guide for beginners please?!
Am using Jupyter notebook.
Thank you,
Steve