You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "orionlibs (via GitHub)" <gi...@apache.org> on 2023/07/02 16:58:35 UTC
[GitHub] [commons-math] orionlibs opened a new pull request, #233: new method that takes a string and extracts a list of numbers
orionlibs opened a new pull request, #233:
URL: https://github.com/apache/commons-math/pull/233
--created a method that takes a string and extracts a list of numbers that it finds inside the string.
--created tests
--this project does not have a class like NumberUtils so, I thought that the most relevant existing class that can hold this method is CompositeFormat for the only reason that it already has number parsing methods.
Please tell me if I should put this method in another class
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-math] aherbert commented on pull request #233: new method that takes string and extracts list of numbers
Posted by "aherbert (via GitHub)" <gi...@apache.org>.
aherbert commented on PR #233:
URL: https://github.com/apache/commons-math/pull/233#issuecomment-1616820363
It is difficult to find a static class to host this method as it is not typically something performed in the math library, i.e. parsing numbers from within text is not within the current scope of math. It is not a mathematical operation or algorithm.
Some legacy classes exist to perform String IO but the current trend in the math derived libraries for new code such as Numbers is to avoid IO conversions as this is locale specific and/or a user specific choice of format. Parsing of strings and formatting to strings delegates to the JDK methods, e.g. `double Double.parseDouble(String)` and `String Double.toString(double)`. Composite numbers are typically delimited strings of standard format numbers, see for example `o.a.c.numbers.complex.Complex` for `static Complex parse(String)` and `String toString()`. For the parsing, no regex is used and all identification of the number is left to `Double.parseDouble`. The commons method is solely responsible for cutting up the string using known delimiters.
I think you may find some interest in the value of this type of method by writing to the dev mailing list. If you put `[math][lang][text]` in the subject heading and start a discussion on the utility of this functionality and the use cases you have, e.g. why are you stripping out numbers from strings but not supporting scientific notation; what mystery input strings are you wishing to decipher and use the numbers from?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-math] orionlibs commented on pull request #233: new method that takes string and extracts list of numbers
Posted by "orionlibs (via GitHub)" <gi...@apache.org>.
orionlibs commented on PR #233:
URL: https://github.com/apache/commons-math/pull/233#issuecomment-1616878566
@sebbASF this method was supposed to be just a general utility. I emailed the maillist and I will see what other people say and well. If most people agree with you, then I will just close this PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-math] orionlibs commented on pull request #233: new method that takes string and extracts list of numbers
Posted by "orionlibs (via GitHub)" <gi...@apache.org>.
orionlibs commented on PR #233:
URL: https://github.com/apache/commons-math/pull/233#issuecomment-1616861706
@sebbASF thank you. I will look into it tomorrow since it is 23:14 here. Thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-math] orionlibs closed pull request #233: new method that takes string and extracts list of numbers
Posted by "orionlibs (via GitHub)" <gi...@apache.org>.
orionlibs closed pull request #233: new method that takes string and extracts list of numbers
URL: https://github.com/apache/commons-math/pull/233
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-math] sebbASF commented on pull request #233: new method that takes string and extracts list of numbers
Posted by "sebbASF (via GitHub)" <gi...@apache.org>.
sebbASF commented on PR #233:
URL: https://github.com/apache/commons-math/pull/233#issuecomment-1616865490
Different contexts will need different solutions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-math] orionlibs commented on pull request #233: new method that takes string and extracts list of numbers
Posted by "orionlibs (via GitHub)" <gi...@apache.org>.
orionlibs commented on PR #233:
URL: https://github.com/apache/commons-math/pull/233#issuecomment-1616830468
@aherbert thank you for replying. I put this method in NumberUtils in the LANG project, but they told me there that it probably belongs to MATH because it has to do with numbers. So that is what I did, but the MATH project does not have a lot of string parsing classes and methods. Right? I think. The TEXT project is more about manipulating strings and not extracting data from them. I think it belongs to LANG, because this method doesn't do math calculations. It just uses a base Java Lang class (i.e. String) to extract something. It is a weird method, because it includes a String and numbers.
There are a number of potential uses:
1--This could be particularly useful for data mining or information extraction where you are dealing with unstructured text. It could be a part of a larger Natural Language Processing (NLP) or text analysis tool where numeric information needs to be analyzed separately.
2--If you're parsing contact information and want to separate phone numbers or other numeric information from a larger string.
3--If you are working with log files, XML or JSON data, and you need to extract certain numeric values that are embedded within text.
4--If the dates or times are in a specific format embedded in text, the method can be used to extract the relevant parts.
5--If you're scraping data from websites, it's often the case that useful numeric data like prices, dates, and identifiers are mixed in with other text.
6--if you want to extract all the numbers and perform mathematical operations such as sum, average etc.
7--For analyzing textual data for occurrences of numbers or patterns involving numbers.
8--In chatbots, virtual assistants, or any other AI that interprets human language, to identify and process numbers mentioned in the user's input.
I will email DEV
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-math] sebbASF commented on pull request #233: new method that takes string and extracts list of numbers
Posted by "sebbASF (via GitHub)" <gi...@apache.org>.
sebbASF commented on PR #233:
URL: https://github.com/apache/commons-math/pull/233#issuecomment-1616856138
I'm not convinced that the method is appropriate for a Commons component.
Seems to me any such parsing really needs to be designed for the context in which it is to be used.
Also, as it stands, the proposed method depends on the representation of the decimal point. It also does not allow for thousands separators, and will match numbers with leading or trailing text (e.g. G7, 3G). It also does not allow for large integer numbers beyond the range of Double.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org