Skip to main content

用于提取语料库的最大词频情况下的最长字符串,即用于挖掘语料库中的高频长字符串

Project description

ngram_extration

概述

  • 目的
    用于提取语料库的最大词频情况下的最长字符串,即用于挖掘语料库中的高频长字符串,这类字符串可能是脏文本,也可能是特征文本;
    示例:
    corpus.txt中存在大量的高频字符串,如:
<sprite=3>  
【坐标分享】3级土地 (777,225)    
1级码头-(372,737) 

通过ngram_extration可以快速挖掘这类特征字符串。

  • 安装
pip install ngram_extration
  • 用法
from ngram_extration import NgramExtration

def load_list_from_text(path):
    res = []
    with open(path) as f:
        for l in f:
            res.append(l[:-1])
    return res

ngram_extration = NgramExtration()
contents = load_list_from_text('corpus.txt')
final_feature_list = ngram_extration.extract_ngram(contents, min_df=10, ngram_range=(5,30), analyzer='char', lowercase=False)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ngram_extration-0.0.4.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file ngram_extration-0.0.4.tar.gz.

File metadata

  • Download URL: ngram_extration-0.0.4.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.11

File hashes

Hashes for ngram_extration-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8072150eb2dc98f7d3945ad086e3242b761298154001963b731a548c172aead2
MD5 5b25e778f174f8354387aa4ed374d98d
BLAKE2b-256 049cd0cf099669445428ae3526df6670510b7dd7d9d1a819bac65536ceda123d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page