Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex not working #18

Open
Svalentinow opened this issue Jul 5, 2021 · 2 comments
Open

Regex not working #18

Svalentinow opened this issue Jul 5, 2021 · 2 comments

Comments

@Svalentinow
Copy link

I am currently doing research to understand the software. The regex generated do not seem to be working when used natively in java. For example, using the available dateset References/Lead-Author, the regex "(?<=\. )[^,]++, (?:\w\.)++" does not work.
Is there something that can be done?

Thanks

@ftarlao
Copy link
Collaborator

ftarlao commented Jul 5, 2021

Dear Svalentinow,
it looks like it is syntactically correct, but I'm not sure this is the "optimal" solution (I need to look at our old experimental results). Also I suppose you copied the regex into a java string without escaping correctly. \ should became \\, inside "" and so on. Am I right?

does "not seem to be working" mean that java does not consider the regex to be syntatically ok? In that case the lack of correct escaping may be the cause....

Please elaborate the "not working" statement,

@Svalentinow
Copy link
Author

This is my result, with p as 200 and g as 500. using windows btw.

"datasetName": "References/Lead-Author",
"methodDescription": "Console config",
"comment": "reference",
"experimentDate": "Jun 20, 2021, 4:39:14 PM",
"bestSolution": {
"solutionJS": "(?<=\. )(?=([^,]+))\1, (?=((?:\w\.)+))\2",
"trainingPerformances": {
"character recall": 1.0,
"character precision": 1.0,
"match precision": 1.0,
"character accuracy": 1.0,
"match f-measure": 1.0,
"match recall": 1.0
},
"validationPerformances": {
"character recall": 1.0,
"character precision": 0.9982773471145564,
"match precision": 0.9797979797979798,
"character accuracy": 0.9998701635938717,
"match f-measure": 0.9797979797979798,
"match recall": 0.9797979797979798
},
"learningPerformances": {
"character recall": 1.0,
"character precision": 0.9991554054054054,
"match precision": 0.98989898989899,
"character accuracy": 0.9999334796780417,
"match f-measure": 0.98989898989899,
"match recall": 0.98989898989899
},
"solution": "(?<=\. )[^,]++, (?:\w\.)++",
"fitness": [
0.0,
0.0,
26.0
]
},

I am using a basic code to test the regex, with the reference/lead author dataset.

public class Test
{
public static void main(String[] args) {
Pattern p = Pattern.compile("(?<=\\. )[^,]++, (?:\\w\\.)++");
Matcher m = p.matcher("19. Allen, M.P., Tildesley, D.J.: Computer simulation of liquids. Oxford university press (1989)");
boolean b = m.matches();
System.out.print(b);
}
}

It is not a syntax error. With your suggestion, i did add more backslash. It should return true with the example string that was provided in the labelled data set. But its false.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants