当前位置: 首页>>代码示例>>Python>>正文


Python IOtools.todisc_freqdist方法代码示例

本文整理汇总了Python中sentimentfinding.IOtools.todisc_freqdist方法的典型用法代码示例。如果您正苦于以下问题:Python IOtools.todisc_freqdist方法的具体用法?Python IOtools.todisc_freqdist怎么用?Python IOtools.todisc_freqdist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sentimentfinding.IOtools的用法示例。


在下文中一共展示了IOtools.todisc_freqdist方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: diff_word_lists

# 需要导入模块: from sentimentfinding import IOtools [as 别名]
# 或者: from sentimentfinding.IOtools import todisc_freqdist [as 别名]
def diff_word_lists(list1, list2, outdir, outfilename):
    l = list(set(list1) - set(list2))
    IOtools.todisc_list(outdir+os.sep+outfilename+".txt", l)
    
    fdist = nltk.FreqDist(l)
    IOtools.todisc_freqdist(outdir+os.sep+"weighted-"+outfilename+".txt", fdist)
    return l
开发者ID:dicleoztur,项目名称:subjectivity_detection,代码行数:9,代码来源:articleanalysis.py

示例2: get_label_counts

# 需要导入模块: from sentimentfinding import IOtools [as 别名]
# 或者: from sentimentfinding.IOtools import todisc_freqdist [as 别名]
def get_label_counts(annottype, agreementtype, labelrootfolder=metacorpus.annotatedrootpath, statsfolder=metacorpus.annotationstatsfolder):

    dfpath = metacorpus.get_annotatedtexts_file_path(annottype, agreementtype)
    labeldf = IOtools.readcsv(dfpath)
    #nrows, _ = labeldf.shape

    labeldist = FreqDist(labeldf["answer"].values.tolist())
    
    outpath = os.path.join(statsfolder, annottype+"_"+agreementtype+"-labeloccurrences.csv")
    IOtools.todisc_freqdist(outpath, labeldist)
开发者ID:dicleoztur,项目名称:subjectivity_detection,代码行数:12,代码来源:annotationstats.py

示例3: merge_word_lists

# 需要导入模块: from sentimentfinding import IOtools [as 别名]
# 或者: from sentimentfinding.IOtools import todisc_freqdist [as 别名]
def merge_word_lists(indirectory, outdirectory, outfilename):
    fileids = IOtools.getfilenames_of_dir(indirectory, removeextension=False)
    

    allwords = []    
    for fileid in fileids:
        words = IOtools.readtextlines(indirectory+os.sep+fileid)
        allwords.extend(words)
    IOtools.todisc_list(outdirectory+os.sep+outfilename+".txt", allwords)
    
    fdist = nltk.FreqDist(allwords)
    IOtools.todisc_freqdist(outdirectory+os.sep+"weighted-"+outfilename+".txt", fdist)
    '''
开发者ID:dicleoztur,项目名称:subjectivity_detection,代码行数:15,代码来源:articleanalysis.py

示例4: intersect_word_lists

# 需要导入模块: from sentimentfinding import IOtools [as 别名]
# 或者: from sentimentfinding.IOtools import todisc_freqdist [as 别名]
def intersect_word_lists(list1, list2, outdir, outfilename):
    intersect = []
    allwords = []
    allwords.extend(list1)
    allwords.extend(list2)
    
    
    
    for w1 in list1:
        if w1 in list2:
            intersect.append(w1)
    IOtools.todisc_list(outdir+os.sep+outfilename+".txt", intersect)
    
    fdist = nltk.FreqDist(intersect)
    fdist2 = nltk.FreqDist(list2)
    for item in list(fdist2):
        fdist.inc(item, fdist2[item])
    IOtools.todisc_freqdist(outdir+os.sep+"weighted-"+outfilename+".txt", fdist)
    return intersect
开发者ID:dicleoztur,项目名称:subjectivity_detection,代码行数:21,代码来源:articleanalysis.py


注:本文中的sentimentfinding.IOtools.todisc_freqdist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。