Skip to content

Commit

Permalink
fix: fix blank issue
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 21, 2023
1 parent b1f464e commit dbcca15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SimilarChunksStrategyBuilder(private val context: JobContext) :
""
}

if (similarChunks.isNotBlank()) {
if (similarChunks.isBlank()) {
return@mapNotNull null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class JavaSimilarChunker(private val fileTree: HashMap<String, InstructionFileJo
val beforeCursor = lines.takeLast(snippetLength).joinToString("\n")

val canonicalNames = fileTree.keys.filter { it != canonicalName }
val relatedCodePath = cannonicalNameLevelJaccardSimilarity(canonicalNames, canonicalName)
val relatedCodePath = canonicalNameLevelJaccardSimilarity(canonicalNames, canonicalName)
.toList()
.sortedByDescending { it.first }
.take(maxRelevantFiles)
Expand Down Expand Up @@ -62,7 +62,7 @@ class JavaSimilarChunker(private val fileTree: HashMap<String, InstructionFileJo
return SimilarChunkContext("java", relatedCodePath, similarChunksText)
}

private fun cannonicalNameLevelJaccardSimilarity(chunks: List<String>, text: String): Map<Double, String> {
private fun canonicalNameLevelJaccardSimilarity(chunks: List<String>, text: String): Map<Double, String> {
val packageName = packageNameTokenize(text)
return chunks.mapNotNull { chunk ->
val chunkPackageName = packageNameTokenize(chunk)
Expand Down

0 comments on commit dbcca15

Please sign in to comment.