Sixads数据科学项目的通用函数

SixAdsDS的Python项目详细描述


六个ADSML

Sixads数据科学部门使用的包。要了解更多关于六个广告的信息, 访问https://sixads.net/" rel="nofollow">https://sixads.net/

这个包的github链接是https://bitbucket.org/eligijus112/sixadsml/src/master/

安装

在anaconda提示符中键入(windows用户):

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS

sixadsml.clean_文本

文本预处理/摘要功能。 使用这些函数的一种常见方法是将它们组合到一个管道中,该管道的输入是一个包含字符串的列表。

引理单词

lemmatize_word(string_list,engine=<WordNetLemmatizer>)

使用WordNet引擎之一对单词进行元素化处理

参数

字符串列表:列表 列出存储字符串的列表

引擎:wordnetlemmatizer()(默认) nltk.stem.wodnet库中的对象

返回

List with the same length as *string_list* where each word in each
string is lemmatized

至街道

to_str(string_list)

将每个列表元素转换为str类型

参数

字符串列表:列表 列出存储字符串的列表

返回

List with the same length as *string_list* where every list element
is converted to a str type object

rm_短单词

rm_short_words(string_list,lower_bound=1,upper_bound=2)

删除下限上限范围内的字符

参数

字符串列表:列表 列出存储字符串的列表

下限:int 表示字符长度下限的整数

上限:int 表示字符长度上限的整数

返回

List with the same length as *string_list* where every character that is
split by whitespace is removed if it has a length in the range
[lower_bound, upper_bound]

示例

< Buff行情>< Buff行情>< Buff行情>

string_list=['python很棒','r也不错]

< Buff行情>< Buff行情>< Buff行情>

rm_短单词(字符串列表)

< Buff行情>< Buff行情>< Buff行情>

rm_短单词(字符串列表,4,5)

单程

to_single(string_list)

将字符串列表中的每个单词转换为单数形式。

参数

字符串列表:列表 列出存储字符串的列表

返回

List with the same length as *string_list* where every word is converted
to singular form

降低

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS
0

使字符串列表中的每个单词都小写

参数

字符串列表:列表 列出存储字符串的列表

返回

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS
1

rm_stop_单词

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS
2

使用NLTK StopWords模块删除停止字。

参数

字符串列表:列表 列出存储字符串的列表

返回

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS
3

rm_标点

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS
4

从字符串列表中删除标点和其他特殊字符

参数

字符串列表:列表 列出存储字符串的列表

返回

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS
5

rm_数字

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS
6

从字符串列表中删除数字

参数

字符串列表:列表 列出存储字符串的列表

返回

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS
7

词干

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS
8

在给定字符串向量中词干的函数

参数

字符串列表:列表 列出存储字符串的列表

词干分析器:来自nltk.stem库的单词词干分析器; nltk.stem.snowballstemmer('english')默认值

返回

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS
9

清洁工作

lemmatize_word(string_list,engine=<WordNetLemmatizer>)
0

清除一个或多个空格

参数

字符串列表:列表 列出存储字符串的列表

返回

lemmatize_word(string_list,engine=<WordNetLemmatizer>)
1

构建声卡

lemmatize_word(string_list,engine=<WordNetLemmatizer>)
2

从文本中创建术语频率词汇表的函数

参数

字符串列表:列表 列出存储字符串的列表

详细:布尔;默认值=真 是否显示for循环的计时

返回

lemmatize_word(string_list,engine=<WordNetLemmatizer>)
3

示例

< Buff行情>< Buff行情>< Buff行情>

string_list=string_list=['python是awesome','r也是awesome']

< Buff行情>< Buff行情>< Buff行情>

构建人声(字符串列表)

sixadsml.images

从Web或本地计算机预处理图像的功能

img_read_url

lemmatize_word(string_list,engine=<WordNetLemmatizer>)
4

通过URL返回图像

参数

URL:字符串 URL(字符串格式)

h:整数 返回图像的所需高度(px)

w:整数 返回图像的所需宽度(px)

到灰色:布尔 图像应该用灰度返回吗?

超时:int 删除请求前的最长等待时间

返回

lemmatize_word(string_list,engine=<WordNetLemmatizer>)
5

img_read_url_pil

lemmatize_word(string_list,engine=<WordNetLemmatizer>)
6

通过URL返回图像(使用PIL框架)

参数

URL:字符串 URL(字符串格式)

h:整数 返回图像的所需高度(px)

w:整数 返回图像的所需宽度(px)

超时:int 删除请求前的最长等待时间

返回

lemmatize_word(string_list,engine=<WordNetLemmatizer>)
7

img_读取

lemmatize_word(string_list,engine=<WordNetLemmatizer>)
8

从本地计算机读取图像

参数

路径:字符串 本地计算机上的映像路径

h:整数 返回图像的所需高度(px)

w:整数 返回图像的所需宽度(px)

到灰色:布尔 图像应该用灰度返回吗?

返回

lemmatize_word(string_list,engine=<WordNetLemmatizer>)
9

返回图像历史

List with the same length as *string_list* where each word in each
string is lemmatized
0

函数获取照片中颜色的直方图

参数

图像:numpy ndarray 具有形状(x,y,3)的numpy数组

每个频道没有存储箱:int 一个histgoram应该为每个颜色通道有多少个箱子

规范化:bool 坐标加起来应该是1吗?

返回

List with the same length as *string_list* where each word in each
string is lemmatized
1

sixadsml.utility

实用功能

建立连接

List with the same length as *string_list* where each word in each
string is lemmatized
2

根据规范中的信息创建连接。正式地, specs字典是read-yaml函数的输出

参数

规格:字典 存储用户、密码、主机和数据库键的字典

返回

List with the same length as *string_list* where each word in each
string is lemmatized
3

exec_文件

List with the same length as *string_list* where each word in each
string is lemmatized
4

执行扩展名为.py的文件

参数

文件:字符串 python文件的路径

添加参数: 正在执行的文件中使用的其他参数

返回

List with the same length as *string_list* where each word in each
string is lemmatized
5

阅读"yaml"

List with the same length as *string_list* where each word in each
string is lemmatized
6

读取.yml或.yaml文件

参数

路径:字符串

List with the same length as *string_list* where each word in each
string is lemmatized
7

返回

List with the same length as *string_list* where each word in each
string is lemmatized
8

大块n

List with the same length as *string_list* where each word in each
string is lemmatized
9

将列表拆分为n个大小相等的列表

参数

l:列表

n:int

返回

to_str(string_list)
0

独特

to_str(string_list)
1

返回列表或numpy数组的唯一元素的便捷函数

参数

l:列表或数组

返回

to_str(string_list)
2

sixadsml.sql_实用程序

用于将数据下载并写入数据库的函数

获取SQL

to_str(string_list)
3

处理下载数据的类

获取谷歌树

to_str(string_list)
4

从Sixads数据库下载Google分类树的功能

参数

连接:SQL逻辑连接对象

返回

to_str(string_list)
5

获取数据

to_str(string_list)
6

从给定部分构造查询并执行它的函数

参数

选择部件:列表 标识所需列的字符串列表

来自部件:字符串 表名

其中部分:字符串 附加构造

返回

to_str(string_list)
5

编写SQL

to_str(string_list)
8

处理写入数据的类

H3>写作<表< /H3>
to_str(string_list)
9

将数据写入所需的表

参数

规格:字典 必须包含密钥用户、密码、主机和数据库

表格:字符串 引用要写入的表的字符串

数据:熊猫数据帧 要写入表中的数据

如果存在:字符串 如果表已经存在,该怎么办。可能的字符串值: "替换"、"追加"、"失败"

sixadsml.嵌入

用于处理单词嵌入的类

从文本加载
List with the same length as *string_list* where every list element
is converted to a str type object
0

从TXT文档中读取单词embeddings并将其保存为字典

参数

路径:字符串 包含单词embeddings的txt文档的路径

返回

List with the same length as *string_list* where every list element
is converted to a str type object
1

标记化文本

List with the same length as *string_list* where every list element
is converted to a str type object
2

从给定的文本列表创建标记器

参数

字符串列表:列表 包含字符串的列表

最大功能:int 标记器在内存中保存的最大唯一单词数

最大长度:int 字符串列表的所有元素都将进入的向量的长度 转换为。

返回

List with the same length as *string_list* where every list element
is converted to a str type object
3

创建嵌入矩阵

List with the same length as *string_list* where every list element
is converted to a str type object
4

函数创建嵌入矩阵以用于神经网络。这样下去 直接到嵌入层。

参数

嵌入:字典 函数的load_输出

标记器:keras.tokenizer对象 tokenize_text()函数的输出

最大功能:int 要使用多少个唯一的标记

嵌入大小:int 嵌入有多少个坐标;默认值=300

返回

List with the same length as *string_list* where every list element
is converted to a str type object
5

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为什么即使我已经给出了代码中的所有权限,该代码也没有在emulator中运行?   java Android Studio正在抛出“线程中的异常”main“javax.net.ssl.SSLException:收到致命警报:协议\版本”   java中的for循环嵌套foreach语句   java读取/src/main/resources和/webinf/classes下的文件   java无法以此格式构造JSON响应   身份验证尝试从CAS secure rest api获取响应,但从java客户端获取登录页面作为响应   如何在java中使用excel从第1列和第3列获取单元格值,并将其作为键值对放入map中   在Java程序中打开Windows虚拟键盘   java有没有递归调用findMatch的方法?   java Pig脚本/命令,用于根据多个字符串筛选文件   java最小数量应匹配,应与POST匹配   java打开/关闭声音按钮不工作   Java嵌入式数据库持久性   java在方法调用时引发异常   java文本文件被覆盖而不是保存的问题   java Hibernate sql注释