Skip to content

Instantly share code, notes, and snippets.

View masud-technope's full-sized avatar
🎯
Focusing

Masud Rahman masud-technope

🎯
Focusing
View GitHub Profile
public void collectSourceTermStatsCRCCExt(String itemType) {
ArrayList<String> allTokens = new ArrayList<>();
ArrayList<String> srcFiles = new ArrayList<>();
for (String fileURL : this.results) {
// avoid other files than Java
if (!fileURL.endsWith(".java"))
continue;
String fileName = new File(fileURL).getName();
// String activeURL = this.repoFolder + "/" + fileName;
int index = Integer.parseInt(fileName.split("\\.")[0]);
package developer.experience;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import json.loader.RepoPRJSONLoader;
import repo.commit.loader.RepoCommitMapLoader;
import config.StaticData;
package malletwork;
import cc.mallet.types.*;
import cc.mallet.pipe.*;
import cc.mallet.pipe.iterator.*;
import cc.mallet.topics.*;
import java.util.*;
import java.util.regex.*;
\ccsdesc[500]{Software and its engineering~Software verification and validation}
\ccsdesc[500]{Software and its engineering~Software testing and debugging}
%\ccsdesc[300]{Software and its engineering~Software defect analysis}
%\ccsdesc[100]{Software and its engineering~Software maintenance tools}
%\printccsdesc
%\terms{Theory, Metrics, Human factors}
\keywords{Debugging automation, bug localization, bug report quality, query reformulation, information retrieval, graph-based term weighting}
package lucenecheck;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
\begin{table}
\centering
\caption{\textbf{Comparison with Popular Web/Code Search Engines}}\label{table:comparison-se}
%\vspace{-.2cm}
\resizebox{3.6in}{!}{%
\begin{threeparttable}
\begin{tabular}{l|c|c|c|c}
\hline
\textbf{Technique} & \textbf{Hit@10} & \textbf{MAP@10} & \textbf{MRR@10} & \textbf{NDCG@10}\\
\hline
@masud-technope
masud-technope / IDFCalculation.java
Created July 16, 2018 19:17
IDF Calculation with Lucene
public HashMap<String, Double> calculateIDFOnly() {
IndexReader reader = null;
HashMap<String, Double> inverseDFMap = new HashMap<>();
try {
reader = DirectoryReader.open(FSDirectory
.open(new File(indexFolder).toPath()));
// String targetTerm = "breakpoint";
Fields fields = MultiFields.getFields(reader);
for (String field : fields) {
@masud-technope
masud-technope / Lucene TF calc
Created July 13, 2018 20:18
Lucene TF calculation
public static final String FIELD_CONTENTS = "contents";
public HashMap<String, Long> calculateTF() {
HashMap<String, Long> termFreqMap = new HashMap<>();
try {
IndexReader reader = DirectoryReader.open(FSDirectory
.open(new File(indexFolder).toPath()));
// String targetTerm = "breakpoint";
DocumentBuilderFactory docFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
// root elements
Document doc = docBuilder.newDocument();
Element rootElement = doc.createElement("bugrepository");
rootElement.setAttribute("name", repoName);
doc.appendChild(rootElement);
for (BugEntry bentry : entries) {
Element bugElement = doc.createElement("bug");
try {
File myFile = new File(fileName);
if(!myFile.exists()){
System.err.println("File does not exist: "+ fileName);
}
BufferedReader reader = new BufferedReader(new FileReader(myFile));
while (reader.ready()) {
String line = reader.readLine();
content += line + "\n";
}