coordle/backend/coordle_backend.py
def fit(self, text: str, cleaner: Callable=None, **kwargs) -> tuple:
        '''
        Create sentence vectors for all sentences in given text.
        
        Parameters:
        text: Text as string

        cleaner: Text cleaning function, should take in a string as first
                 argument, and return an iterable of cleaned tokens from string.
                 If None is given,defaults to clean_text from bundled utils
                 module

        kwargs: Keyword arguments for cleaner function

        Returns
        --------
        Tuple of self and the cleaned and tokenized sentences
        (self, unique_tokens)
        '''
        if type(text) == str:
            if cleaner is None:
                cleaner = clean_text
            tokens = cleaner(text)
        elif isinstance(text, Iterable):
            tokens = text
        else:
            raise ValueError(f'Unsupported type for text, got f{type(text)}')

        self.len = len(tokens)

        temp = pd.value_counts(tokens)
        uniques = temp.index.values
        counts = temp.values

        self.wordcounts = {word:count for word, count in zip(uniques, counts)}
        return self, uniques

        Create sentence vectors for all sentences in given text.
        
        Parameters:
        text: Text as string

        cleaner: Text cleaning function, should take in a string as first
                 argument, and return an iterable of cleaned tokens from string.
                 If None is given,defaults to clean_text from bundled utils
                 module

        kwargs: Keyword arguments for cleaner function

        Returns
        --------
        Tuple of self and the cleaned and tokenized sentences
        (self, unique_tokens)
        
Create sentence vectors for all sentences in given text.
Parameters:
text: Text as string

Text cleaning function, should take in a string as first
argument, and return an iterable of cleaned tokens from string.
If None is given,defaults to clean_text from bundled utils
module

Keyword arguments for cleaner function

Returns

Tuple of self and the cleaned and tokenized sentences
(self, unique_tokens)
Create sentence vectors for all sentences in given text . Parameters : text : Text as string Text cleaning function should take in a string as first argument and return an iterable of cleaned tokens from string . If None is given defaults to clean_text from bundled utils module Keyword arguments for cleaner function Returns Tuple of self and the cleaned and tokenized sentences ( self unique_tokens )
def fit(self, text: str, cleaner: Callable=None, **kwargs) -> tuple:
        if type(text) == str:
            if cleaner is None:
                cleaner = clean_text
            tokens = cleaner(text)
        elif isinstance(text, Iterable):
            tokens = text
        else:
            raise ValueError(f'Unsupported type for text, got f{type(text)}')
        self.len = len(tokens)
        temp = pd.value_counts(tokens)
        uniques = temp.index.values
        counts = temp.values
        self.wordcounts = {word:count for word, count in zip(uniques, counts)}
        return self, uniques
def fit ( self , text : str , cleaner : Callable = None , ** kwargs ) -> tuple : if type ( text ) == str : if cleaner is None : cleaner = clean_text tokens = cleaner ( text ) elif isinstance ( text , Iterable ) : tokens = text else : raise ValueError ( f'Unsupported type for text, got f{type(text)}' ) self . len = len ( tokens ) temp = pd . value_counts ( tokens ) uniques = temp . index . values counts = temp . values self . wordcounts = { word : count for word , count in zip ( uniques , counts ) } return self , uniques
Create sentence vectors for all sentences in given text.
Create sentence vectors for all sentences in given text .
'''
        Create sentence vectors for all sentences in given text.
        
        Parameters:
        text: Text as string

        cleaner: Text cleaning function, should take in a string as first
                 argument, and return an iterable of cleaned tokens from string.
                 If None is given,defaults to clean_text from bundled utils
                 module

        kwargs: Keyword arguments for cleaner function

        Returns
        --------
        Tuple of self and the cleaned and tokenized sentences
        (self, unique_tokens)
        '''
self
text
str
cleaner
Callable