There is no fixed legal meaning to "non-commercial", instead, every license must define what is meant by "non-commercial", if it uses that term. CC BY-NC 4.0 says that
NonCommercial means not primarily intended for or directed towards
commercial advantage or monetary compensation. For purposes of this
Public License, the exchange of the Licensed Material for other
material subject to Copyright and Similar Rights by digital
file-sharing or similar means is NonCommercial provided there is no
payment of monetary compensation in connection with the exchange.
That would mean that you cannot sell software of a dataset so licensed, but you could give it away.
Copyright does not prohibit using a work as raw data for some kind of analysis, such as counting occurrences of words, so it is legal to publish a table of word-counts from the Harry Potter novels, even though you can't publish the novels without permission. The word counts are facts, not "expression", and copyright doesn't protect facts.
It is possible that your initial access to the expressive work was contingent on not doing something with that work, for example a license to copy a book in the first place might be contingent on you not using the data for purposes of statistical analysis. For Harry Potter books, there's really no way to show that Smith could only have gained access to the work by agreeing to a certain license and showing that Smith did agree (Potter books are everywhere). It is possible that some work is so well controlled that you did indeed agree to "not subject the work to statistical analysis". It is highly unlikely that there is any such condition is attached to a work that has is "non-commercially" licensed. You can read the license and see what it actually says. Basically, an abstract model of X is not X itself, it is a fact about X, and facts are not protected.