Skip to main content

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

Project description

ngram_extration

概述

  • 目的
    用于提取语料库的最大词频情况下的最长字符串,即用于挖掘语料库中的高频长字符串,这类字符串可能是脏文本,也可能是特征文本;
    示例:
    corpus.txt中存在大量的高频字符串,如:
<sprite=3>  
【坐标分享】3级土地 (777,225)  
新技术!苹果手机三年冲的钱退回,你和代褪失败可以,不影响游戏,威信T9883K  
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.3.tar.gz (4.3 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: ngram_extration-0.0.3.tar.gz
  • Upload date:
  • Size: 4.3 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.3.tar.gz
Algorithm Hash digest
SHA256 020148278936625ec225f8467068add366a41c4461a63437f1073812c9598f41
MD5 a84a8895478fc72f217f65d6b11cf3e9
BLAKE2b-256 7519ecb9727a42d9b1e27264adecc7d0f021c15c16746a0eaeadecd184719fac

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