jboynyc / textnets

Text analysis with networks.
https://textnets.readthedocs.io/
GNU General Public License v3.0
284 stars 23 forks source link

Bugs? Layout, community detection, projecting #29

Closed henri-rq closed 3 years ago

henri-rq commented 3 years ago

Description

Not sure if bugs or I'm just not using the library right.

  1. Plotting only works if I specify another layout, the default fruchterman_reingold doesn't work.
  2. Community detection fails.
  3. So does the project function

I have a pandas dataframe containing 2 columns, document id (index) and document text.

Sorry if I'm missing something obvious :( And thanks for your work!

What I Did

corpus = Corpus.from_df(df)
bi_pwn_net = Textnet(corpus.noun_phrases(normalize=True), min_docs=5)

And then the following crashes (works if I specify another layout):

bi_pwn_net.plot(label_term_nodes=True, scale_nodes_by="degree")

As well as the following:

bi_pwn_net.plot(circular_layout=True, label_term_nodes=True, scale_nodes_by="degree", show_clusters=True)

As well as trying to project a single mode network:

words = bi_pwn_net.project(node_type='term')

image

image

image

jboynyc commented 3 years ago

Thanks for the report! I'll investigate what may be going on here later this week.

henri-rq commented 3 years ago

Much appreciated!

jboynyc commented 3 years ago

Sorry, it's a busy time so I haven't gotten to the bottom of this yet.

Could you help me verify a hunch I have? Did you install via conda-forge? I believe I relaxed some of the version requirements for the dependencies in the conda package, and it looks like an API might have changed in one or more dependencies.

henri-rq commented 3 years ago

I did, yes. Only because it didn't work using pip install. Sorry, I didn't take a screenshot of the error at the time. However, I tried using the library in a Google Colab session (installing it with pip install) and everything worked with no issues there.

jboynyc commented 3 years ago

OK, great. Glad you were able to make things work! A new release is overdue, and I will make sure to update the conda-forge package when I push it out.

jboynyc commented 3 years ago

This issue will probably be solved when I make a new Conda package of the upcoming 0.5 release.