You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Gian Maria Ricci <al...@nablasoft.com> on 2013/06/13 10:19:11 UTC
analyzer for Code
I did a little search around and did not find anything interesting. Anyone
know if some analyzers exists to better index source code (es C#, C++. Java
etc)?
Standard analyzer is quite good, but I wish to know if there are some more
specific analyzers that can do a better indexing. Es I did a little try with
C# and the full class name was indexed without splitting by dots. So
MyLib.Helpers.Myclass becomes one token and when I search for MyClass I did
not find matches.
Thanks in advance.
--
Gian Maria Ricci
Mobile: +39 320 0136949
<http://mvp.microsoft.com/en-us/mvp/Gian%20Maria%20Ricci-4025635>
<http://www.linkedin.com/in/gianmariaricci>
<https://twitter.com/alkampfer> <http://feeds.feedburner.com/AlkampferEng>
<skype://alkampferaok/>
RE: analyzer for Code
Posted by Gian Maria Ricci <al...@nablasoft.com>.
Thanks very much for the suggestion, it sounds interesting.
--
Gian Maria Ricci
Mobile: +39 320 0136949
-----Original Message-----
From: Otis Gospodnetic [mailto:otis.gospodnetic@gmail.com]
Sent: Friday, June 14, 2013 2:59 AM
To: solr-user@lucene.apache.org; alkampfer@nablasoft.com
Subject: Re: analyzer for Code
Gian,
Lucene in Action has a case study from Krugle about their analysis for a
code search engine, if you want to look there.
Otis
--
Solr & ElasticSearch Support
http://sematext.com/
On Thu, Jun 13, 2013 at 4:19 AM, Gian Maria Ricci
<al...@nablasoft.com>wrote:
> I did a little search around and did not find anything interesting.
> Anyone know if some analyzers exists to better index source code (es
> C#, C++. Java
> etc)?****
>
> ** **
>
> Standard analyzer is quite good, but I wish to know if there are some
> more specific analyzers that can do a better indexing. Es I did a
> little try with C# and the full class name was indexed without
> splitting by dots. So MyLib.Helpers.Myclass becomes one token and when
> I search for MyClass I did not find matches. ****
>
> ** **
>
> Thanks in advance.****
>
> ** **
>
> --****
>
> Gian Maria Ricci****
>
> Mobile: +39 320 0136949****
>
> <http://mvp.microsoft.com/en-us/mvp/Gian%20Maria%20Ricci-4025635> [image:
> https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQyg0wiW_QuTxl-rn
> uVR2P0jGuj4qO3I9attctCNarL--FC3vdPYg]<http://www.linkedin.com/in/gianm
> ariaricci>
> [image:
> https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT8z0HpwpDSjDWw1I
> 59Yx7HmF79u-NnP0NYeYYyEyWM1WtIbOl7]<https://twitter.com/alkampfer>
> [image:
> https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQQWMj687BGGypKMU
> Tub_lkUrull1uU2LTx0K2tDBeu3mNUr7Oxlg]<http://feeds.feedburner.com/Alka
> mpferEng>
> [image:
> https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSkTG_lPTPFe470xf
> DtiInUtseqKcuV_lvI5h_-8t_3PsY5ikg3]
> ****
>
> ** **
>
> ** **
>
Re: analyzer for Code
Posted by Otis Gospodnetic <ot...@gmail.com>.
Gian,
Lucene in Action has a case study from Krugle about their analysis for a
code search engine, if you want to look there.
Otis
--
Solr & ElasticSearch Support
http://sematext.com/
On Thu, Jun 13, 2013 at 4:19 AM, Gian Maria Ricci
<al...@nablasoft.com>wrote:
> I did a little search around and did not find anything interesting. Anyone
> know if some analyzers exists to better index source code (es C#, C++. Java
> etc)?****
>
> ** **
>
> Standard analyzer is quite good, but I wish to know if there are some more
> specific analyzers that can do a better indexing. Es I did a little try
> with C# and the full class name was indexed without splitting by dots. So
> MyLib.Helpers.Myclass becomes one token and when I search for MyClass I did
> not find matches. ****
>
> ** **
>
> Thanks in advance.****
>
> ** **
>
> --****
>
> Gian Maria Ricci****
>
> Mobile: +39 320 0136949****
>
> <http://mvp.microsoft.com/en-us/mvp/Gian%20Maria%20Ricci-4025635> [image:
> https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQyg0wiW_QuTxl-rnuVR2P0jGuj4qO3I9attctCNarL--FC3vdPYg]<http://www.linkedin.com/in/gianmariaricci>
> [image:
> https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT8z0HpwpDSjDWw1I59Yx7HmF79u-NnP0NYeYYyEyWM1WtIbOl7]<https://twitter.com/alkampfer>
> [image:
> https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQQWMj687BGGypKMUTub_lkUrull1uU2LTx0K2tDBeu3mNUr7Oxlg]<http://feeds.feedburner.com/AlkampferEng>
> [image:
> https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSkTG_lPTPFe470xfDtiInUtseqKcuV_lvI5h_-8t_3PsY5ikg3]
> ****
>
> ** **
>
> ** **
>
RE: analyzer for Code
Posted by Gian Maria Ricci <al...@nablasoft.com>.
I'll have a look to it, thanks to everyone.
--
Gian Maria Ricci
Mobile: +39 320 0136949
-----Original Message-----
From: Steve Rowe [mailto:sarowe@gmail.com]
Sent: Thursday, June 13, 2013 9:03 PM
To: solr-user@lucene.apache.org
Subject: Re: analyzer for Code
Hi Gian Maria,
OpenGrok <http://opengrok.github.io/OpenGrok/> has a bunch of JFlex-based
computer language tokenizers for Lucene:
<https://github.com/OpenGrok/OpenGrok/tree/master/src/org/opensolaris/opengr
ok/analysis>. Not sure how much work it would be to use them in another
project, though.
There's a bunch of JFlex grammars listed here, though most (almost all?) are
not integrated with Lucene:
<http://sourceforge.net/apps/mediawiki/jflex/index.php?title=ExternalJFlexGr
ammars>
Looks like at least the Jsyntaxpane and RSyntaxTextArea projects have
multiple programming language lexers.
Steve
On Jun 13, 2013, at 1:40 PM, Gian Maria Ricci <al...@nablasoft.com>
wrote:
> Thanks for the suggestions, I'll try with the
> WordDelimiterFilterFactory. My aim is not to have a perfect analysis,
> just a way to quick search for words in the whole history of a
> codebase. J
>
> --
> Gian Maria Ricci
> Mobile: +39 320 0136949
>
>
>
> From: Erick Erickson [mailto:erickerickson@gmail.com]
> Sent: Thursday, June 13, 2013 1:24 PM
> To: solr-user@lucene.apache.org; Gian Maria Ricci
> Subject: Re: analyzer for Code
>
> Well, WordDelimiterFilterFactory would split on the punctuation, so
> you could add it to the analyzer chain along with StandardAnalyzer.
>
> You could use one of the regex filters to break up tokens that make it
> through the analyzer as you see fit.
>
> But in general, this will be a bunch of compromises since programming
> languages are, shall we say, not standard <G>
>
> Best
> Erick
>
>
> On Thu, Jun 13, 2013 at 4:19 AM, Gian Maria Ricci
<al...@nablasoft.com> wrote:
> I did a little search around and did not find anything interesting. Anyone
know if some analyzers exists to better index source code (es C#, C++. Java
etc)?
>
> Standard analyzer is quite good, but I wish to know if there are some more
specific analyzers that can do a better indexing. Es I did a little try with
C# and the full class name was indexed without splitting by dots. So
MyLib.Helpers.Myclass becomes one token and when I search for MyClass I did
not find matches.
>
> Thanks in advance.
>
> --
> Gian Maria Ricci
> Mobile: +39 320 0136949
>
>
>
Re: analyzer for Code
Posted by Steve Rowe <sa...@gmail.com>.
Hi Gian Maria,
OpenGrok <http://opengrok.github.io/OpenGrok/> has a bunch of JFlex-based computer language tokenizers for Lucene: <https://github.com/OpenGrok/OpenGrok/tree/master/src/org/opensolaris/opengrok/analysis>. Not sure how much work it would be to use them in another project, though.
There's a bunch of JFlex grammars listed here, though most (almost all?) are not integrated with Lucene:
<http://sourceforge.net/apps/mediawiki/jflex/index.php?title=ExternalJFlexGrammars>
Looks like at least the Jsyntaxpane and RSyntaxTextArea projects have multiple programming language lexers.
Steve
On Jun 13, 2013, at 1:40 PM, Gian Maria Ricci <al...@nablasoft.com> wrote:
> Thanks for the suggestions, I’ll try with the WordDelimiterFilterFactory. My aim is not to have a perfect analysis, just a way to quick search for words in the whole history of a codebase. J
>
> --
> Gian Maria Ricci
> Mobile: +39 320 0136949
>
>
>
> From: Erick Erickson [mailto:erickerickson@gmail.com]
> Sent: Thursday, June 13, 2013 1:24 PM
> To: solr-user@lucene.apache.org; Gian Maria Ricci
> Subject: Re: analyzer for Code
>
> Well, WordDelimiterFilterFactory would split on the punctuation, so
> you could add it to the analyzer chain along with StandardAnalyzer.
>
> You could use one of the regex filters to break up tokens that make it
> through the analyzer as you see fit.
>
> But in general, this will be a bunch of compromises since programming
> languages are, shall we say, not standard <G>
>
> Best
> Erick
>
>
> On Thu, Jun 13, 2013 at 4:19 AM, Gian Maria Ricci <al...@nablasoft.com> wrote:
> I did a little search around and did not find anything interesting. Anyone know if some analyzers exists to better index source code (es C#, C++. Java etc)?
>
> Standard analyzer is quite good, but I wish to know if there are some more specific analyzers that can do a better indexing. Es I did a little try with C# and the full class name was indexed without splitting by dots. So MyLib.Helpers.Myclass becomes one token and when I search for MyClass I did not find matches.
>
> Thanks in advance.
>
> --
> Gian Maria Ricci
> Mobile: +39 320 0136949
>
>
>
RE: analyzer for Code
Posted by Gian Maria Ricci <al...@nablasoft.com>.
Thanks for the suggestions, I'll try with the WordDelimiterFilterFactory. My
aim is not to have a perfect analysis, just a way to quick search for words
in the whole history of a codebase. :)
--
Gian Maria Ricci
Mobile: +39 320 0136949
<http://mvp.microsoft.com/en-us/mvp/Gian%20Maria%20Ricci-4025635>
<http://www.linkedin.com/in/gianmariaricci>
<https://twitter.com/alkampfer> <http://feeds.feedburner.com/AlkampferEng>
<skype://alkampferaok/>
From: Erick Erickson [mailto:erickerickson@gmail.com]
Sent: Thursday, June 13, 2013 1:24 PM
To: solr-user@lucene.apache.org; Gian Maria Ricci
Subject: Re: analyzer for Code
Well, WordDelimiterFilterFactory would split on the punctuation, so
you could add it to the analyzer chain along with StandardAnalyzer.
You could use one of the regex filters to break up tokens that make it
through the analyzer as you see fit.
But in general, this will be a bunch of compromises since programming
languages are, shall we say, not standard <G>
Best
Erick
On Thu, Jun 13, 2013 at 4:19 AM, Gian Maria Ricci <alkampfer@nablasoft.com
<ma...@nablasoft.com> > wrote:
I did a little search around and did not find anything interesting. Anyone
know if some analyzers exists to better index source code (es C#, C++. Java
etc)?
Standard analyzer is quite good, but I wish to know if there are some more
specific analyzers that can do a better indexing. Es I did a little try with
C# and the full class name was indexed without splitting by dots. So
MyLib.Helpers.Myclass becomes one token and when I search for MyClass I did
not find matches.
Thanks in advance.
--
Gian Maria Ricci
Mobile: +39 320 0136949 <tel:%2B39%20320%200136949>
<http://mvp.microsoft.com/en-us/mvp/Gian%20Maria%20Ricci-4025635>
Re: analyzer for Code
Posted by Erick Erickson <er...@gmail.com>.
Well, WordDelimiterFilterFactory would split on the punctuation, so
you could add it to the analyzer chain along with StandardAnalyzer.
You could use one of the regex filters to break up tokens that make it
through the analyzer as you see fit.
But in general, this will be a bunch of compromises since programming
languages are, shall we say, not standard <G>
Best
Erick
On Thu, Jun 13, 2013 at 4:19 AM, Gian Maria Ricci
<al...@nablasoft.com>wrote:
> I did a little search around and did not find anything interesting. Anyone
> know if some analyzers exists to better index source code (es C#, C++. Java
> etc)?****
>
> ** **
>
> Standard analyzer is quite good, but I wish to know if there are some more
> specific analyzers that can do a better indexing. Es I did a little try
> with C# and the full class name was indexed without splitting by dots. So
> MyLib.Helpers.Myclass becomes one token and when I search for MyClass I did
> not find matches. ****
>
> ** **
>
> Thanks in advance.****
>
> ** **
>
> --****
>
> Gian Maria Ricci****
>
> Mobile: +39 320 0136949****
>
> <http://mvp.microsoft.com/en-us/mvp/Gian%20Maria%20Ricci-4025635> [image:
> https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQyg0wiW_QuTxl-rnuVR2P0jGuj4qO3I9attctCNarL--FC3vdPYg]<http://www.linkedin.com/in/gianmariaricci>
> [image:
> https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT8z0HpwpDSjDWw1I59Yx7HmF79u-NnP0NYeYYyEyWM1WtIbOl7]<https://twitter.com/alkampfer>
> [image:
> https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQQWMj687BGGypKMUTub_lkUrull1uU2LTx0K2tDBeu3mNUr7Oxlg]<http://feeds.feedburner.com/AlkampferEng>
> [image:
> https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSkTG_lPTPFe470xfDtiInUtseqKcuV_lvI5h_-8t_3PsY5ikg3]
> ****
>
> ** **
>
> ** **
>
Re: analyzer for Code
Posted by Walter Underwood <wu...@wunderwood.org>.
It could be pretty complicated to do well.
I'm pretty sure that Krugle is based on Solr: http://opensearch.krugle.org/
You might also look at the UI for Ohloh (used to be Koders): http://code.ohloh.net/
wunder
On Jun 13, 2013, at 1:19 AM, Gian Maria Ricci wrote:
> I did a little search around and did not find anything interesting. Anyone know if some analyzers exists to better index source code (es C#, C++. Java etc)?
>
> Standard analyzer is quite good, but I wish to know if there are some more specific analyzers that can do a better indexing. Es I did a little try with C# and the full class name was indexed without splitting by dots. So MyLib.Helpers.Myclass becomes one token and when I search for MyClass I did not find matches.
>
> Thanks in advance.
>
> --
> Gian Maria Ricci
> Mobile: +39 320 0136949
>
>
>
--
Walter Underwood
wunder@wunderwood.org