Giter VIP home page Giter VIP logo

Comments (2)

ggianna avatar ggianna commented on August 28, 2024

In DocumentWordGraph we utilize the utils.splitToWords function, to split the text to words.
There we used a RegExp to split based on punctuation and spaces:
Originally it was
String [] sRes = sStr.split("(\\s|\\p{Punct})+");
In the specific files, there exist too many whitespace characters. Can be fixed by simply ignoring full groups of whitespace/punctuation as follows:
String [] sRes = sStr.split("(\\s+|\\p{Punct}+)+");

As a temporary solution, you can simply replace all multi-whitespace sequences in the text with a single space, before feeding it to the graph:

       String text = utils.loadFileToString("inputText.txt");
        text = text.replaceAll("\\s+", " ");
        DocumentWordGraph wg = new DocumentWordGraph();
        wg.setDataString(text); // stack overflow error - no longer here! :)
        
        System.out.println(wg.getGraphLevel(0));

I will try to update the utils class appropriately... sometime soon.

from jinsect.

npit avatar npit commented on August 28, 2024

Thank you for the swift reply!

from jinsect.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.