r/spacynlp • • Mar 18 '19

spaCy v2.1 out now

Thumbnail
explosion.ai
12 Upvotes

r/spacynlp • • Nov 07 '17

spaCy 2.0.0 released!

Thumbnail
github.com
12 Upvotes

r/spacynlp • • Apr 18 '20

Named Entity Recognition For Product Names Of Clothes With SpaCy

11 Upvotes

I am trying to extract product names from a plain text, the problem with product names is that they don't have a specific pattern and I don't want to give the algorithm a set of data that has fixed names I want it to be generic.

I am using SpaCy and I'm looking for a way to make it detect the product names as an Entity.

Any help please?

Here's an example of the text

Order dispatched Your new clothes are on their way. Track your

delivery with Royal Mail: VB 9593 7366 0GB

Order Details

Men's Dark Navy Jersey Cotton Lounge Shorts Size: XL

£45.00

Men's Navy Cotton Jersey Lounge Pants Size: XL

£60.00

Delivery £0.00

Total £95.00

I want to extract

Men's Navy Cotton Jersey Lounge

and

Men's Dark Navy Jersey Cotton Lounge Shorts

For your information this text is an email of orders and I have a lot of different patterns of emails.


r/spacynlp • • Feb 04 '19

StanfordNLP and spaCy

10 Upvotes

So a couple of days ago, the Stanford group made their Python package publicly available. Explosion was quick to follow up with a spaCy wrapper around it. However, I am a bit confused as to what the advantage/disadvantages are or perhaps even what this wrapper is actually doing.

My assumption is that the wrapper ensure the same interface as you normally would with spaCy, and that it uses the same classes (e.g. Tokenizer, Language ...). The only difference would be, then, the language models. Is that true?

Also, do you have any idea about the quality of the models? Stanford has been around for ages, so one can imagine that their models are quite good - however, spaCy does have RNN models (which I think Stanford has not?). So what is the advantage of one over the other, or of using the wrapper in itself?


r/spacynlp • • Sep 30 '16

spaCy User Survey

Thumbnail
survey.spacy.io
10 Upvotes

r/spacynlp • • Aug 23 '19

Classify Text Using spaCy – Dataquest

Thumbnail
dataquest.io
9 Upvotes

r/spacynlp • • Jun 08 '16

Where did displaCy go?

9 Upvotes

https://spacy.io/demos/displacy

Where did it go? When will it be back? It's been a whole day and I miss it a lot.


r/spacynlp • • Aug 10 '16

displaCy Visualizer Now Open-Source

Thumbnail
github.com
8 Upvotes

r/spacynlp • • Aug 26 '19

Extract age using entity recognition in SpaCy

7 Upvotes

Hello everyone,

I would greatly appreciate any help on this manner. I'm trying to extract from texts whether someone mentioned his/her age or asked about someone else's age. Is there a way to do that using age entity recognition in SpaCy? Namely, in a similar way to what you can extract with this https://spacy.io/api/annotation#section-named-entities.

Thank you very much,

Ayala


r/spacynlp • • Oct 05 '17

New models for spaCy 2 alpha -- now near state-of-the-art (NER: 86.4 F on OntoNotes; parsing: 94.4 UAS on WSJ)

Thumbnail
alpha.spacy.io
7 Upvotes

r/spacynlp • • Oct 20 '16

spaCy 1.0 — Now easier to integrate your own models, e.g. with Keras

Thumbnail
explosion.ai
7 Upvotes

r/spacynlp • • Oct 07 '16

Best of luck explosion.ai!

7 Upvotes

Hey Matt & Ines, awesome to see spaCy find a new home for the commercial side of things. Best of luck with the endeavour!


r/spacynlp • • May 04 '16

v0.100.7: German!

7 Upvotes

spaCy finally supports another language, in addition to English. We’re lucky to have Wolfgang Seeker on the team, and the new German model is just the beginning. Now that there are multiple languages, you should consider loading spaCy via the load() function. This function also makes it easier to load extra word vector data for English:

import spacy
en_nlp = spacy.load('en', vectors='en_glove_cc_300_1m_vectors')
de_nlp = spacy.load('de')

To support use of the load function, there are also two new helper functions: spacy.get_lang_class and spacy.set_lang_class. Once the German model is loaded, you can use it just like the English model:

doc = nlp(u'''Wikipedia ist ein Projekt zum Aufbau einer Enzyklopädie aus freien Inhalten, zu dem du mit deinem Wissen beitragen kannst. Seit Mai 2001 sind 1.936.257 Artikel in deutscher Sprache entstanden.''')

for sent in doc.sents:
    print(sent.root.text, sent.root.n_lefts, sent.root.n_rights)
# (u'ist', 1, 2)
# (u'sind', 1, 3)

The German model provides tokenization, POS tagging, sentence boundary detection, syntactic dependency parsing, recognition of organisation, location and person entities, and word vector representations trained on a mix of open subtitles and Wikipedia data. It doesn’t yet provide lemmatisation or morphological analysis, and it doesn’t yet recognise numeric entities such as numbers and dates.

Bugfixes

  • spaCy < 0.100.7 had a bug in the semantics of the Token.str and Token.unicode built-ins: they included a trailing space.

  • Improve handling of “infixed” hyphens. Previously the tokenizer struggled with multiple hyphens, such as “well-to-do”.

  • Improve handling of periods after mixed-case tokens.

  • Improve lemmatization for English special-case tokens.

  • Fix bug that allowed spaces to be treated as heads in the syntactic parse.

  • Fix bug that led to inconsistent sentence boundaries before and after serialisation.

  • Fix bug from deserialising untagged documents.


r/spacynlp • • Feb 01 '20

List of custom models

6 Upvotes

There's a lot of user-made models that are not officially supported, many of which can be found at: https://github.com/explosion/spaCy/issues/3056 It would be very nice if someone builds a curated list of these.


r/spacynlp • • Nov 12 '17

How spaCy's neural entity recognition model works (1h)

Thumbnail
youtube.com
6 Upvotes

r/spacynlp • • Mar 15 '17

Is spaCy really ready for production?

6 Upvotes

Recently my team tried out spaCy for preprocessing textual data. The claim that it is the fastest Python NLP system around and has "industrial strength" seemed to match our needs, as we process several thousand documents per minute. We solely needed the tokenizer for now, having in mind that we might use more advanced NLP features later. In the following I will describe some problems that we ran into, that put some serious doubt into the stability of the software for a production system.

  • We built a debian package for spaCy. There is a cascade of dependencies spaCy brings along. There is no distinction between training and classification, thus every library that is used for training also needs to come along on the production machine, even if we didn't need any of them. One library doesn't compile out of the box because of programming errors in the current version (v1.6.0).

  • spaCy includes a download service for models, which actually tries to save the downloaded model in the spaCy module directory. While that might be considered only bad practice in a user installation, loading code from the web is unacceptable for production environments (though it will fail anyways if there are no serious misconfigurations).

  • When installing the PyPi spaCy v1.6.0 on any of our machines (Fedora, Ubuntu or debian), the resulting spaCy module is broken. When loading spaCy, it throws an error when the Tagger tries to load the thinc module (which is maintained by the spaCy authors), because "thinc.linear.avgtron.AveragedPerceptron has the wrong size, try recompiling". Obviously the PyPI installation is not tested well, if this can happen. This is unacceptable, since apart from conda and PyPI there is no other packaging of spaCy.

  • Between v1.4.0 and v1.6.0 in the included German corpus, which we use, stop words have been added/changed, which broke some of our unit tests. Usually, breaking changes should be reflected in a major version change. Apart from that, spaCy currently has a high release rate, and breaking changes every couple of weeks clearly is not usable for industrial applications.

  • A final detail that annoyed us when working with token matchers:There is no way to match an "any" token. So looking for patterns like "number anything number" needs workarounds.

In spaCy's current state we cannot responsibly deploy it on our production machines. What experiences have others made with regard to stability and reliablity? I would like to hear about it and whether there are plans of improving spaCy for production environments that we should know about.


r/spacynlp • • Feb 17 '16

New demo: sense2vec on Reddit 2015

Thumbnail sense2vec.spacy.io
6 Upvotes

r/spacynlp • • Mar 20 '20

Named Entity Recognition with Bert on very long Italian documents

5 Upvotes

As the title suggests, I'm wondering if it's feasible to use Bert to solve the Entity Named Recognition task on long legal documents (> 50.000 chars) in Italian. Now I'm using Spacy, and I'm obtaining actually decent results and I want to know if using this pre-trained model can help me somehow.

I've tried to search but I didn't understand if Bert can be used for this type of task (I see people treating NER like a multiclassification task). Also, is Bert something that can be used WITH the bidirectional LSTM (Spacy default NER architecture)?

By the way, I'm seeing people using it in Medium articles, but they use it on very short text examples, so I don't know if the same approach can solve for long articles.

If it can help, I have roughly 400 documents, each with hundreds of instances of hand-annotated labels (12 different entities).

This idea came to be because yesterday some Italian guys open sourced GilBERTo, and Italian version of the popular model.

Sorry if my questions are dumb. Thanks a lot in advance, if you can suggest me a good approach or point me to a related resource!


r/spacynlp • • Nov 04 '19

Model en_core_web_sm

5 Upvotes

Hey guys!

Can someone explain me how the similarity function within the pretrained sm-model is working?

I want to compare two text documents with individual words in it. I have read that the sm-model only include context-sensitive tensors. What is this exactly compared to vectors?


r/spacynlp • • Oct 10 '19

init-model: tool to create JSONL-formatted attribute file

5 Upvotes

Hi all,

I have a large annotated corpus in CoNLL format, that I would like to use to train a language model from scratch.

For what I understand, the init-model command requires in input a JSONL-formatted attribute file (see https://spacy.io/api/annotation#vocab-jsonl), containing all lexemes.

I was wondering if there is a tool to create such file directly from a CoNLL-formatted corpus.

If not, what alternative approach would you suggest?

Thanks in advance for your help.


r/spacynlp • • May 24 '19

Incorrect Output from spaCy tutorial.

5 Upvotes

I am new to spaCy and working through the Advanced NLP with spaCy tutorial on the docs site (https://course.spacy.io/) and have run into a problem.

In "Chapter 1 Section 10: Rule-based matching" I have set up a pattern as instructed with the following:

import spacy

# Import the Matcher
from spacy.matcher import Matcher

# Load a model and create the nlp object
nlp = spacy.load('en_core_web_sm')

# Initialize the matcher with the shared vocab
matcher = Matcher(nlp.vocab)

# Add the pattern to the matcher
pattern = [{'TEXT': 'iPhone'}, {'TEXT': 'X'}]
matcher.add('IPHONE_PATTERN', None, pattern)

# Process some text
doc = nlp("New iPhone X release date leaked")

# Call the matcher on the doc
matches = matcher(doc)

Then:

# Call the matcher on the doc
doc = nlp("New iPhone X release date leaked")
matches = matcher(doc)

# Iterate over the matches
for match_id, start, end in matches:
    # Get the matched span
    matched_span = doc[start:end]
    print(matched_span.text)

This should output, according to the tutorial, iPhone X, yet I am getting the entire string one token per line:

New
iPhone
X
release
date
leaked

Is this a problem in the tutorial, or am I misunderstanding something? When I look at matches I get the following list, so it doesn't appear that the pattern is being matched:

[(52997568, 0, 1),
 (52997568, 1, 2),
 (52997568, 2, 3),
 (52997568, 3, 4),
 (52997568, 4, 5),
 (52997568, 5, 6)]

Help! I continued on to Section 11 of Chapter 1 where they "quiz" you. I successfully completed the quiz in spaCy's own editor and got the desired result (meaning the pattern matching is working there) but on Google Colab where I am also running it all the pattern matching didn't work and I again got the entire string, tokenized.


r/spacynlp • • Feb 15 '19

Microsoft’s New MT-DNN Outperforms Google BERT

Thumbnail
medium.com
5 Upvotes

r/spacynlp • • Dec 01 '18

Using Google BERT word vectors (contextual embeddings) with SpaCy

5 Upvotes

Google BERT is apparently one of the best word embeddings to date, and contrary to GloVe/FastText (as far as I know) they can be fine-tuned to your domain-specific corpus. Is it possible to use them with SpaCy at all? Does it work well in practice, with e.g. the NER stack prediction machine?


r/spacynlp • • Sep 29 '18

spaCy Abbreviation/Acronym Handling

5 Upvotes

I have a large (~50k) term list and a number of these key phrases / terms have corresponding acronyms / abbreviations. I need a fast way of finding either the abbreviation or the expanded abbreviation ( i.e. MS -> Microsoft ) and then replacing that with the full expanded abbreviation + abbreviation ( i.e. Microsoft -> Microsoft (MS) or MS -> Microsoft (MS) ).

I am very new to spaCy, so my naive approach was going to be to use spacy_lookup and use both the abbreviation and the expanded abbreviation as keywords and then using some kind of pipeline extension to then go through the matches and replace them with the full expanded abbreviation + abbreviation.

Is there a better way of handling this?


r/spacynlp • • Sep 26 '18

Clause extraction and Text Simplification in Spacy (github repo provided)

5 Upvotes

Hello,

I tried to reimplement the following paper:

Del Corro Luciano, and Rainer Gemulla. "Clausie: clause-based open information extraction." Proceedings of the 22nd international conference on World Wide Web. ACM, 2013.

Which does sentence information extraction (subject, verb, objects, complements and adverbs), and can also reconstruct it as a list of simpler sentences.

While it's not perfect, it currently works sufficiently for me, I provide python code and problog bindings in the repo:

https://github.com/mmxgn/clausiepy

Example of the things you can do with that (in problog, but the same holds for python):

query(clausie('Albert Einstein, a scientist of the 20th century, died in Princeton in 1955.', Subject, Verb, IndirectObject, DirectObject, Complement, Adverb)).

Output:

clausie('Albert Einstein, a scientist of the 20th century, died in Princeton in 1955.',Einstein,died,,,,):	1             
clausie('Albert Einstein, a scientist of the 20th century, died in Princeton in 1955.',Einstein,died,,,,in 1955):	1    
clausie('Albert Einstein, a scientist of the 20th century, died in Princeton in 1955.',Einstein,died,,,,in Princeton):	1
clausie('Albert Einstein, a scientist of the 20th century, died in Princeton in 1955.',Einstein,is,,,a scientist of the 20th century,):	1