def def_font2char2word2sent2doc():
    adder = add_flags()
    classify = qndex.def_classify()
    word_array = qndex.nlp.def_word_array()

    def model(document, label=None, *, mode, key=None):
        return classify(
            font2char2word2sent2doc(
                document,
                words=word_array(),
                mode=mode,
                fonts=font_array(),
                **adder.flags),
            label,
            key=key,
            predictions={
                'font_attentions': tf.tile(
                    tf.expand_dims(
                        collections.get_attentions()[0],
                        axis=0),
                    [tf.shape(document)[0], 1, 1, 1]),
            },
            mode=mode,
            regularization_scale=qnd.FLAGS.regularization_scale)

    return model
def def_word2sent2doc():
    adder = add_flags()
    classify = qndex.def_classify()

    def model(document, label=None, *, mode):
        return classify(word2sent2doc(document,
                                      word_space_size=len(qnd.FLAGS.words),
                                      **adder.flags),
                        label,
                        mode=mode)

    return model
def def_word2sent2doc():
    adder = add_flags()
    classify = qndex.def_classify()
    get_words = qndex.nlp.def_words()

    def model(document, label=None, *, mode, key=None):
        return classify(word2sent2doc(document,
                                      word_space_size=len(get_words()),
                                      **adder.flags),
                        label,
                        key=key,
                        mode=mode)

    return model
Exemple #4
0
def def_char2word2sent2doc():
    adder = add_flags()
    classify = qndex.def_classify()
    word_array = qndex.nlp.def_word_array()

    def model(document, label=None, *, mode):
        return classify(char2word2sent2doc(document,
                                           words=word_array(),
                                           char_space_size=len(
                                               qnd.FLAGS.chars),
                                           **adder.flags),
                        label,
                        mode=mode)

    return model
def def_word2sent2doc():
    adder = add_flags()
    classify = qndex.def_classify()
    get_words = qndex.nlp.def_words()

    def model(document, label=None, *, mode, key=None):
        return classify(
            word2sent2doc(
                document,
                word_space_size=len(get_words()),
                **adder.flags),
            label,
            key=key,
            mode=mode,
            regularization_scale=qnd.FLAGS.regularization_scale)

    return model
Exemple #6
0
def def_font2char2word2sent2doc():
    adder = add_flags()
    classify = qndex.def_classify()
    word_array = qndex.nlp.def_word_array()

    def model(document, label=None, *, mode, key=None):
        return classify(font2char2word2sent2doc(document,
                                                words=word_array(),
                                                mode=mode,
                                                fonts=font_array(),
                                                **adder.flags),
                        label,
                        mode=mode,
                        key=key,
                        regularization_scale=qnd.FLAGS.regularization_scale)

    return model
Exemple #7
0
def def_char2word2sent2doc():
    adder = add_flags()
    adder.add_flag("char_embedding_size", type=int, default=100)
    classify = qndex.def_classify()
    word_array = qndex.nlp.def_word_array()

    def model(document, label=None, *, mode, key=None):
        return classify(
            char2word2sent2doc(
                document,
                words=word_array(),
                char_space_size=len(qnd.FLAGS.chars),
                **adder.flags),
            label,
            key=key,
            mode=mode,
            regularization_scale=qnd.FLAGS.regularization_scale)

    return model
Exemple #8
0
def def_font2char2word2sent2doc():
    adder = add_flags()
    classify = qndex.def_classify()
    word_array = qndex.nlp.def_word_array()

    def model(document, label=None, *, mode, key=None):
        return classify(font2char2word2sent2doc(document,
                                                words=word_array(),
                                                mode=mode,
                                                fonts=font_array(),
                                                **adder.flags),
                        label,
                        key=key,
                        predictions={
                            'font_attentions':
                            tf.tile(
                                tf.expand_dims(collections.get_attentions()[0],
                                               axis=0),
                                [tf.shape(document)[0], 1, 1, 1]),
                        },
                        mode=mode,
                        regularization_scale=qnd.FLAGS.regularization_scale)

    return model