How to extend code2vec to other languages
masterTo support a new language, you must implement a new extractor (similar to JavaExtractor) and register it in preprocess.sh.
An extractor must output a single text file where each row is an example. Each example must be a space-delimited list of fields:
- The first word is the target label, using
|as an internal delimiter. - Subsequent words are contexts. Each context must consist of three comma-separated components:
token,path,token.
Example Context Format:
foo|Bar System,FIELD_ACCESS,out System.out,FIELD_ACCESS,println THE_METHOD,returns,void THE_METHOD,prints,"hello_world"
In this format, the 1st and 3rd components of a context are drawn from the 'tokens' vocabulary, while the 2nd component is drawn from the 'paths' vocabulary.