Exemplo n.º 1
0
# -*- coding: UTF-8 -*-
'''
Created on 2017年7月21日

@author: superhy
'''

from interface import word_seg, word_embedding, patient_tongue_generator
from interface.tools import get_config
from layer import tongue2text_gen, image_augment

import numpy as np

config = get_config('interface.ini')


#------------------------------------------------------------------------------ preprocess application
def patientTextSeg():

    original_path = config['root_path'] + config[
        'original_path'] + 'zhiliao.list'
    seg_path = config['root_path'] + config['cache_path'] + 'patient_seg.list'

    max_length = word_seg.seg_patient_text(original_path, seg_path)
    print('max_length of patient text: %d' % max_length)


def patientTextWordvec():

    seg_path = config['root_path'] + config['cache_path'] + 'patient_seg.list'
    wordvec_path = config['root_path'] + config[
Exemplo n.º 2
0
# -*- coding: UTF-8 -*-
'''
Created on 2017年9月25日

@author: superhy
'''
from interface import patient_tongue_generator
from interface.tools import get_config
from layer.norm import tfidf

config = get_config('../interface.ini')


def tfidf_weights_test():

    patient_tongue_dir = config['root_path'] + \
        config['original_path'] + 'tongue_9585'
    tongue_zhiliao_path = config['root_path'] + \
        config['original_path'] + 'tongue_zhiliao.list'
    yaopin_path = config['root_path'] + \
        config['original_path'] + 'yaopin.vocab'

    tongue_ids, tongue_image_arrays, tongue_yaofangs, tongue_image_shape = patient_tongue_generator.loadDatafromFile(
        patient_tongue_dir, tongue_zhiliao_path, image_normal_size=(224, 224))
    patient_tongue_dir = config['root_path'] + \
        config['original_path'] + 'tongue_9585'
    tongue_zhiliao_path = config['root_path'] + \
        config['original_path'] + 'tongue_zhiliao.list'

    yaofangs_corpus = tfidf.list2corpus(tongue_yaofangs)
    word, weight = tfidf.get_tf_idf(yaofangs_corpus)