Adding NCL language.
Thanks for the pull request! Do you know if these files are NCL too?
Those are poorly-named documentation files for NCL functions.
- What's better? - This is better.
- Would it be correct to recognise these files as text? - Yes.
In that case, could you add "NCL" to the text entry in languages.yml too?
I added the example to "Text" and updated the license in the grammar submodule.
Cloning the submodule fails for me in local with this URL.
Could you use Git or HTTPS...?
I updated the grammar submodule link to HTTPS.
It's still failing locally. I don't think you can just update the .gitmodules file.
You'll probably have to remove the submodule and add it again to be sure.
- I'll see first if it's not an issue on my side... - I removed the submodule and added it back with HTTPS.
I tested the detection of NCL files with 2000 samples.
The Bayesian classifier doesn't seem to be very good at distinguishing text from NCL.
We could try to improve it by adding more samples, or we can define a new heuristic rule.
- Do you want me to send you the sample files? - Yes, please do.
In your inbox.
- So if I manually go through these and sort out the errors, would that help? - Not really.
It's a matter of keywords so there's not much to do there except for adding new samples.
If adding a few more samples doesn't improve things, we'll see how to define a new heuristic rule.
- I added quite a few NCL samples. - That's a bit over the top, isn't it?
We currently can't add too many samples because of #2117.
(sigh) I decreased the number of added samples.
Could you test the detection results in local with the samples I gave you?
- What is the command to run that test? - Here...
[Coding intensifies]
It is getting hung up on a false detection of Frege in one of the Text samples.
Do you have any suggestions for implementing a heuristic?
#2441 should fix this. In the meantime, you can change this in "test_heuristics.rb"
Why did you have to change this?
- It doesn't work for me unless I do that. - Hum, same for me. Arfon, does it work for you?
Requiring linguist/language doesn't work for me either.
We restructured some of the requires a while ago and I think this is just out-of-date code.
From a large sample of known NCL files taken from Github, it's now predicting with about 98% accuracy.
For a large sample of other files with the NCL extension, it is around 92%.
From those, nearly all of the errors come from one GitHub repository,
and they all contain the text strings, "The URL" and "The Title".
- Do you mean 92% files correctly identified as text? - Yes, it correctly identifies 92% as text.
I'd really like to see this dramatically reduced.
What happens if we reduce to around 5 NCL sample files?
Does Linguist still do a reasonable job?
I reduced it to 16 NCL samples and 8 text samples.
It correctly classifies my whole set of known NCL files.
I tried with 5 samples but could not get the same level of accuracy.
It incorrectly classifies all of the NCL files in this GitHub repository.
All of these files contain the text strings, "THE_URL:" and "THE_TITLE:".
It did not misclassify any other text-files with the extension NCL.
With 100% accuracy? Does that mean it that the results are better with less samples??
I also removed a sample text-file which should have been classified as an NCL file.
I think that probably made most of the difference, although I didn't test it atomically.
Okay, that makes more sense.
I don't get the same results for the text files. Full results here.
They all look correctly classified to me, except for the ones in Fanghuan's repository.
I manually went through all of the ones where I didn't already know based on the filename or the repository owner.
[Presses button] It now correctly classifies all of my test files.
R. Pavlick, thanks for this. These changes will be live in the next release of Linguist. In the next couple of weeks.
Great! Thanks.