
Siamese is a code clone search system powered by Elasticsearch with code clone detection approaches, code normalisation and ngram-based matching, built on top. It can scalably search for clones of type-1 to type-3 from a large corpora of Java source code within seconds.
Note: Siamese stands for Scalalbe, Iusingnstant, And Multi-Representation
TermFreqAnalyser with appropriate configurationstok means the normalised source code tokens, whilst the one with tok means the original source code tokens.wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.2.0/elasticsearch-2.2.0.tar.gz
And extract it to the disk.
tar -xvf elasticsearch-2.2.0.tar.gz
rm elasticsearch-2.2.0.tar.gz
cluster.name: stackoverflow
index.query.bool.max_clause_count: 4096
git clone git@github.com:cragkhit/elasticsearch.git
sudo apt-get update
sudo apt-get install maven
./elasticsearch-2.2.0/bin/elasticsearch -d
sudo apt-get install default-jdk
vim /etc/environment
and paste the location of JAVA_HOME into the file. Note: finding JAVA_HOME by
whereis javac
ls -l <the path>
... keep following the path
Configure config.properties file with appropriate settings
Execute the experiment.
mvn compile exec:java -Dexec.mainClass=crest.siamese.Main -Dexec.args="-cf config.properties"
No. of combinations of IR scoring parameter I searched for:
| Func. | n-gram | code norm. | params | Total |
|---|---|---|---|---|
| TF-IDF | 4 | 64 | 3 | 768 |
| BM25 | 4 | 64 | 552 | 12800 |
| DFR | 4 | 64 | 735 | 26880 |
| IB | 4 | 64 | 225 | 5120 |
| LM Dirichlet | 4 | 64 | 6 | 1536 |
| LM Jelinek Mercer | 4 | 64 | 10 | 2560 |
| Grand total | 49664 |
$ claude mcp add Siamese \
-- python -m otcore.mcp_server <graph>