module documentation

Undocumented

Function cheated Clustering of messages with hierarchical ascending classification but pre-implemented so it's cheating :param corpus: list of str :return: None
Function clustering Clustering of messages with hierarchical ascending classification :param messages: list of discord.Message :param similarityMatrix: np.matrix :param quantity: str :param messageInitIndex: int :return: list of list of discord...
Function clusterSimilarity Compute the similarity between clusters :param similarityMatrix: np.matrix :param clusters: list of np.ndarray :return: np.matrix
Function cosine_distance Compute the cosine distance between two lists of float :param list1: List of float :param list2: List of float :return: float
Function distance Compute the distance between two messages :param embeddingMessage1: np.ndarray :param embeddingMessage2: np.ndarray :return: Float
Async Function doTldr Main function of the tldr command, call every function needed to summarize the chat :param bot: The bot :param message: The message that call the command :param messageToEdit: The message to edit with the summary :param quantity: The quantity of summary to send :param position: The position of the summary :param timeGap: The time gap between the summary :return: None...
Function dumpjsonMatrix Dump the similarity matrix in json Used to debug and test :param similarityMatrix: The similarity matrix :return: None
Function euclidean_distance Compute the euclidean distance between two lists of float :param list1: List of float :param list2: List of float :return: float
Function findMinMatrix Find the minimum value of a matrix :param similarityMatrix: np.ndarray :return: int, int, float
Function getChatByTime Get messages from a channel around, after or before a message depending on the position parameter :param bot: Discord bot :param messageInit: Message around which we want to get the messages :param timeGap: Time gap in minutes :param positionParameter: Position parameter :return: List of messages, index of the messageInit in the list...
Async Function getMessagesAfter Coroutines to get messages after a message :param channel: Channel to get the messages :param message: Message after which we want to get the messages :param limit: Limit of messages to get :return: List of messages...
Async Function getMessagesBefore Coroutines to get messages before a message :param channel: Channel to get the messages :param message: Message before which we want to get the messages :param limit: Limit of messages to get :return: List of messages...
Function getTranslatedMessage create a list of translted messages :param messages: List of discord.Message :return: List of string
Function minTwoCluster Compute the distance between two clusters :param cluster1: list of int :param cluster2: list of int :param similarityMatrix: np.matrix :return: float
Function postionParameter Compute the postion parameter String to a tuple of boolean :param position: String of the position parameter :return: Tuple of boolean (above, below)
Function printCluster Print the clusters Used to debug and test :param clusters: The clusters :return: None
Function printSimilarityMatrix Print the similarity matrix Used to debug and test :param similarityMatrix: The similarity matrix :return: None
Function quantityParameter Compute the quantity parameter String to a boolean :param quantity: String of the quantity parameter :return: Boolean
Function remove_non_alphanumeric Process text to remove very special characters :param text: String to process :return: Processed string
Function sendSummarises Send the summarises :param bot: discord.Client :param messageToEdit: discord.Message :param listSummarise: list of tuple of str and discord.Message :return: None
Function similarity More like a distance matrix, 0 = same message, 1 = totally different, -1 = not computed :param tokenMessages: list of list of string :param messages: list of discord.Message :return: np.matrix of size len(messages) x len(messages) and embedding of messages...
Function similarityAll More like a distance matrix, 0 = same message, 1 = totally different, -1 = not computed :param tokenMessages: list of list of string :param messages: list of discord.Message :return: np.matrix of size len(messages) x len(messages) and embedding of messages...
Function summarize Summarize Every cluster of messages :param messagesCluster: list of list of discord.Message :return: list of tuple of, Summary For one cluster and the first message of the cluster
Function wardDistance Compute the Ward distance between two clusters :param cluster1: list of int :param cluster2: list of int :param similarityMatrix: np.matrix :return: float
Variable sentenceModel Undocumented
Variable summarizer Undocumented
@printExceptions
def cheated(corpus):

Clustering of messages with hierarchical ascending classification but pre-implemented so it's cheating :param corpus: list of str :return: None

@printExceptions
def clustering(messages, similarityMatrix, quantity, messageInitIndex):

Clustering of messages with hierarchical ascending classification :param messages: list of discord.Message :param similarityMatrix: np.matrix :param quantity: str :param messageInitIndex: int :return: list of list of discord.Message

Parameters
messages:list[discord.Message]Undocumented
similarityMatrix:np.ndarrayUndocumented
quantity:strUndocumented
messageInitIndex:intUndocumented
Returns
list[list[discord.Message]]Undocumented
@printExceptions
def clusterSimilarity(similarityMatrix, clusters):

Compute the similarity between clusters :param similarityMatrix: np.matrix :param clusters: list of np.ndarray :return: np.matrix

Parameters
similarityMatrix:np.ndarrayUndocumented
clusters:list[np.ndarray]Undocumented
Returns
np.ndarrayUndocumented
@printExceptions
def cosine_distance(list1, list2):

Compute the cosine distance between two lists of float :param list1: List of float :param list2: List of float :return: float

Parameters
list1:np.ndarrayUndocumented
list2:np.ndarrayUndocumented
Returns
np.float64Undocumented
@printExceptions
def distance(embeddingMessage1, embeddingMessage2):

Compute the distance between two messages :param embeddingMessage1: np.ndarray :param embeddingMessage2: np.ndarray :return: Float

Parameters
embeddingMessage1:np.ndarrayUndocumented
embeddingMessage2:np.ndarrayUndocumented
@printExceptions
async def doTldr(bot, message, messageToEdit, quantity='one', position='around', timeGap=5):

Main function of the tldr command, call every function needed to summarize the chat :param bot: The bot :param message: The message that call the command :param messageToEdit: The message to edit with the summary :param quantity: The quantity of summary to send :param position: The position of the summary :param timeGap: The time gap between the summary :return: None

Parameters
bot:discord.ClientUndocumented
message:discord.MessageUndocumented
messageToEdit:discord.MessageUndocumented
quantity:strUndocumented
position:strUndocumented
timeGap:intUndocumented
@printExceptions
def dumpjsonMatrix(similarityMatrix):

Dump the similarity matrix in json Used to debug and test :param similarityMatrix: The similarity matrix :return: None

Parameters
similarityMatrix:np.arrayUndocumented
@printExceptions
def euclidean_distance(list1, list2):

Compute the euclidean distance between two lists of float :param list1: List of float :param list2: List of float :return: float

Parameters
list1:np.ndarrayUndocumented
list2:np.ndarrayUndocumented
Returns
floatUndocumented
@printExceptions
def findMinMatrix(similarityMatrix):

Find the minimum value of a matrix :param similarityMatrix: np.ndarray :return: int, int, float

Parameters
similarityMatrix:np.ndarrayUndocumented
Returns
tuple[int, int, float]Undocumented
@printExceptions
def getChatByTime(bot, messageInit, timeGap, positionParameter='around'):

Get messages from a channel around, after or before a message depending on the position parameter :param bot: Discord bot :param messageInit: Message around which we want to get the messages :param timeGap: Time gap in minutes :param positionParameter: Position parameter :return: List of messages, index of the messageInit in the list

Parameters
bot:discord.ClientUndocumented
messageInit:discord.MessageUndocumented
timeGap:intUndocumented
positionParameterUndocumented
Returns
tuple[list, int]Undocumented
@printExceptions
async def getMessagesAfter(channel, message, limit):

Coroutines to get messages after a message :param channel: Channel to get the messages :param message: Message after which we want to get the messages :param limit: Limit of messages to get :return: List of messages

Parameters
channel:discord.TextChannelUndocumented
message:discord.MessageUndocumented
limit:intUndocumented
Returns
list[discord.Message]Undocumented
@printExceptions
async def getMessagesBefore(channel, message, limit):

Coroutines to get messages before a message :param channel: Channel to get the messages :param message: Message before which we want to get the messages :param limit: Limit of messages to get :return: List of messages

Parameters
channel:discord.TextChannelUndocumented
message:discord.MessageUndocumented
limit:intUndocumented
Returns
list[discord.Message]Undocumented
@printExceptions
def getTranslatedMessage(messages):

create a list of translted messages :param messages: List of discord.Message :return: List of string

Parameters
messages:list[discord.Message]Undocumented
Returns
list[str]Undocumented
@printExceptions
def minTwoCluster(cluster1, cluster2, similarityMatrix):

Compute the distance between two clusters :param cluster1: list of int :param cluster2: list of int :param similarityMatrix: np.matrix :return: float

Returns
floatUndocumented
@printExceptions
def postionParameter(position):

Compute the postion parameter String to a tuple of boolean :param position: String of the position parameter :return: Tuple of boolean (above, below)

Parameters
position:strUndocumented
Returns
tuple[bool, bool]Undocumented
@printExceptions
def printCluster(clusters):

Print the clusters Used to debug and test :param clusters: The clusters :return: None

@printExceptions
def printSimilarityMatrix(similarityMatrix):

Print the similarity matrix Used to debug and test :param similarityMatrix: The similarity matrix :return: None

Parameters
similarityMatrix:np.arrayUndocumented
@printExceptions
def quantityParameter(quantity):

Compute the quantity parameter String to a boolean :param quantity: String of the quantity parameter :return: Boolean

Parameters
quantity:strUndocumented
Returns
boolUndocumented
@printExceptions
def remove_non_alphanumeric(text):

Process text to remove very special characters :param text: String to process :return: Processed string

Returns
strUndocumented
@printExceptions
def sendSummarises(bot, messageToEdit, listSummarise):

Send the summarises :param bot: discord.Client :param messageToEdit: discord.Message :param listSummarise: list of tuple of str and discord.Message :return: None

Parameters
bot:discord.ClientUndocumented
messageToEdit:discord.MessageUndocumented
listSummarise:list[tuple[str, discord.Message]]Undocumented
@printExceptions
def similarity(tokenMessages, messages):

More like a distance matrix, 0 = same message, 1 = totally different, -1 = not computed :param tokenMessages: list of list of string :param messages: list of discord.Message :return: np.matrix of size len(messages) x len(messages) and embedding of messages

Parameters
tokenMessages:list[str]Undocumented
messages:list[discord.Message]Undocumented
Returns
np.ndarrayUndocumented
@printExceptions
def similarityAll(tokenMessages, messages):

More like a distance matrix, 0 = same message, 1 = totally different, -1 = not computed :param tokenMessages: list of list of string :param messages: list of discord.Message :return: np.matrix of size len(messages) x len(messages) and embedding of messages

Parameters
tokenMessages:list[str]Undocumented
messages:list[discord.Message]Undocumented
Returns
np.ndarrayUndocumented
@printExceptions
def summarize(messagesCluster):

Summarize Every cluster of messages :param messagesCluster: list of list of discord.Message :return: list of tuple of, Summary For one cluster and the first message of the cluster

Parameters
messagesCluster:list[list[discord.Message]]Undocumented
Returns
list[tuple[str, discord.Message]]Undocumented
@printExceptions
def wardDistance(cluster1, cluster2, similarityMatrix):

Compute the Ward distance between two clusters :param cluster1: list of int :param cluster2: list of int :param similarityMatrix: np.matrix :return: float

Returns
floatUndocumented
sentenceModel =

Undocumented

summarizer =

Undocumented