(events, field, delimiters=None, num_perm=None,
                  threshold=None)
return lsh, minhashes
Create a new LSH from a set of Timesketch events.

    Args:
        events: list or an iterator of Event objects.
        field: string denoting the event field to use for the LSH.
        delimiters: list of strings used as delimiters for splitting text
            into words.
        num_perm: number of random permutation functions used by MinHash to
            be indexed.
        threshold: a float for the Jaccard similarity threshold between 0.0 and
            1.0. The initialized MinHash LSH will be optimized for the
            threshold by minizing the false positive and false negative.

    Returns:
        A tuple with an LSH (instance of datasketch.lsh.LSH) and a
        dictionary with event ID as key and minhash as value.
Create a new LSH from a set of Timesketch events.
Create a new LSH from a set of Timesketch events .
def new_lsh_index(events, field, delimiters=None, num_perm=None,
                  threshold=None):
    """Create a new LSH from a set of Timesketch events.

    Args:
        events: list or an iterator of Event objects.
        field: string denoting the event field to use for the LSH.
        delimiters: list of strings used as delimiters for splitting text
            into words.
        num_perm: number of random permutation functions used by MinHash to
            be indexed.
        threshold: a float for the Jaccard similarity threshold between 0.0 and
            1.0. The initialized MinHash LSH will be optimized for the
            threshold by minizing the false positive and false negative.

    Returns:
        A tuple with an LSH (instance of datasketch.lsh.LSH) and a
        dictionary with event ID as key and minhash as value.
    """
    if delimiters is None:
        delimiters = DEFAULT_DELIMITERS
    if num_perm is None:
        num_perm = DEFAULT_PERMUTATIONS
    if threshold is None:
        threshold = DEFAULT_THRESHOLD

    minhashes = {}
    lsh = MinHashLSH(threshold, num_perm)

    with lsh.insertion_session() as lsh_session:
        for event in events:
            # Insert minhash in LSH index.
            key = (event.event_id, event.event_type, event.index_name)
            minhash = minhash_from_text(
                event.source[field], num_perm, delimiters)
            minhashes[key] = minhash
            lsh_session.insert(key, minhash)

    return lsh, minhashes
def new_lsh_index ( events , field , delimiters = None , num_perm = None , threshold = None ) : if delimiters is None : delimiters = DEFAULT_DELIMITERS if num_perm is None : num_perm = DEFAULT_PERMUTATIONS if threshold is None : threshold = DEFAULT_THRESHOLD minhashes = { } lsh = MinHashLSH ( threshold , num_perm ) with lsh . insertion_session ( ) as lsh_session : for event in events : # Insert minhash in LSH index. key = ( event . event_id , event . event_type , event . index_name ) minhash = minhash_from_text ( event . source [ field ] , num_perm , delimiters ) minhashes [ key ] = minhash lsh_session . insert ( key , minhash ) return lsh , minhashes