-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sreang Rathanak
committed
Dec 26, 2023
1 parent
0645fd9
commit 245f6a5
Showing
6 changed files
with
100 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
app/src/main/java/com/rathanak/khmerroman/keyboard/smartbar/SpellSuggestionItem.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
app/src/main/java/com/rathanak/khmerroman/request/ApiService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
package com.rathanak.khmerroman.request | ||
|
||
import retrofit2.Call | ||
import retrofit2.http.Body | ||
import retrofit2.http.GET | ||
import retrofit2.http.POST | ||
import retrofit2.http.Path | ||
|
||
interface ApiService { | ||
@GET("/spelling-check") | ||
fun spellCheckIng(@Path("id") postId: Int): Call<SpellCheckResultDTO> | ||
@POST("/v1/spelling-check") | ||
fun spellCheckIng(@Body requestBody: SpellCheckRequestDTO): Call<SpellCheckRespondDTO> | ||
} |
35 changes: 33 additions & 2 deletions
35
app/src/main/java/com/rathanak/khmerroman/request/SpellCheckResultDTO.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,35 @@ | ||
package com.rathanak.khmerroman.request | ||
|
||
class SpellCheckResultDTO { | ||
} | ||
data class SpellCheckResultDTO( | ||
val startIndex: Int, | ||
val endIndex: Int, | ||
val word: String, | ||
val suggestions: Array<String>, | ||
val scores: Array<Float> | ||
) { | ||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
|
||
other as SpellCheckResultDTO | ||
|
||
if (startIndex != other.startIndex) return false | ||
if (endIndex != other.endIndex) return false | ||
if (word != other.word) return false | ||
if (!suggestions.contentEquals(other.suggestions)) return false | ||
return scores.contentEquals(other.scores) | ||
} | ||
|
||
override fun hashCode(): Int { | ||
var result = startIndex | ||
result = 31 * result + endIndex | ||
result = 31 * result + word.hashCode() | ||
result = 31 * result + suggestions.contentHashCode() | ||
result = 31 * result + scores.contentHashCode() | ||
return result | ||
} | ||
} | ||
|
||
data class SpellCheckRespondDTO(val results: ArrayList<SpellCheckResultDTO>) | ||
|
||
data class SpellCheckRequestDTO (val text: String) |