https://github.com/loehnertz/semantic-coupling
A library to compute the semantic coupling between source code files
https://github.com/loehnertz/semantic-coupling
kotlin nlp semantic-analysis semantic-coupling semantic-similarity
Last synced: about 1 year ago
JSON representation
A library to compute the semantic coupling between source code files
- Host: GitHub
- URL: https://github.com/loehnertz/semantic-coupling
- Owner: loehnertz
- License: apache-2.0
- Created: 2019-05-28T14:47:19.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-06-20T22:41:34.000Z (almost 4 years ago)
- Last Synced: 2023-03-04T15:52:50.447Z (over 3 years ago)
- Topics: kotlin, nlp, semantic-analysis, semantic-coupling, semantic-similarity
- Language: Kotlin
- Homepage:
- Size: 67.4 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://jitpack.io/#loehnertz/semantic-coupling)
# semantic-coupling
A library to compute the semantic coupling between source code files (e.g. classes)
## Participation
**The library currently only supports source code written in Java and the English language.**
I am very happy to pull other sets of programming and natural languages into this library, just open a PR for them.
## Usage
- Add this library to your own project: https://jitpack.io/#loehnertz/semantic-coupling/rc4
- If you are using Kotlin as well, just go ahead and instantiate the main class:
```
val files: List = retrieveFiles()
val fileContentsMap: Map = files.map { convertFileNameToIdentifier(it.absolutePath) to it.readText() }.toMap() // A map of file name to raw file contents
val semanticCouplingCalculator = SemanticCouplingCalculator(
files = fileContentsMap,
programmingLanguage = ProgrammingLanguage.JAVA,
naturalLanguage = NaturalLanguage.EN
)
val semanticCouplings: List = semanticCouplingCalculator.calculate()
```
- If you are using Java, you can do pretty much the same:
```
SemanticCouplingCalculator semanticCouplingCalculator = new SemanticCouplingCalculator(fileContentsMap, ProgrammingLanguage.JAVA, NaturalLanguage.EN);
List semanticCouplings = semanticCouplingCalculator.calculate();
```
If you have any further questions, just open an issue or send me an e-mail.