storage.ClassifiedSentenceDAO.kt Maven / Gradle / Ivy
The newest version!
/*
* Copyright (C) 2017/2021 e-voyageurs technologies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ai.tock.nlp.front.service.storage
import ai.tock.nlp.front.shared.config.ApplicationDefinition
import ai.tock.nlp.front.shared.config.ClassifiedSentence
import ai.tock.nlp.front.shared.config.ClassifiedSentenceStatus
import ai.tock.nlp.front.shared.config.EntityDefinition
import ai.tock.nlp.front.shared.config.IntentDefinition
import ai.tock.nlp.front.shared.config.SentencesQuery
import ai.tock.nlp.front.shared.config.SentencesQueryResult
import org.litote.kmongo.Id
import java.util.Locale
/**
* Manage sentences of the NLP model.
*/
interface ClassifiedSentenceDAO {
fun updateFormattedSentences(applicationId: Id)
fun getSentences(
intents: Set>?,
language: Locale?,
status: ClassifiedSentenceStatus?
): List
fun deleteSentencesByStatus(status: ClassifiedSentenceStatus)
fun deleteSentencesByApplicationId(applicationId: Id)
fun save(sentence: ClassifiedSentence)
fun search(query: SentencesQuery): SentencesQueryResult
fun switchSentencesIntent(
applicationId: Id,
oldIntentId: Id,
newIntentId: Id
)
fun switchSentencesIntent(sentences: List, newIntentId: Id)
fun switchSentencesEntity(
allowedNamespace: String,
sentences: List,
oldEntity: EntityDefinition,
newEntity: EntityDefinition
)
fun switchSentencesStatus(sentences: List, newStatus: ClassifiedSentenceStatus)
fun removeEntityFromSentences(
applicationId: Id,
intentId: Id,
entityType: String,
role: String
)
fun removeSubEntityFromSentences(applicationId: Id, entityType: String, role: String)
/**
* Increment unknown stat.
*/
fun incrementUnknownStat(
/**
* The application id.
*/
applicationId: Id,
/**
* The locale.
*/
language: Locale,
/**
* The text of the sentence.
*/
text: String
)
/**
* Returns sentence validator users.
*/
fun users(applicationId: Id): List
/**
* Returns sentence channel source.
*/
fun configurations(applicationId: Id): List
}