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 SixAdsDS0
使字符串列表中的每个单词都小写
参数
字符串列表:列表 列出存储字符串的列表
返回
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS1
rm_stop_单词
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS2
使用NLTK StopWords模块删除停止字。
参数
字符串列表:列表 列出存储字符串的列表
返回
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS3
rm_标点
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS4
从字符串列表中删除标点和其他特殊字符
参数
字符串列表:列表 列出存储字符串的列表
返回
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS5
rm_数字
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS6
从字符串列表中删除数字
参数
字符串列表:列表 列出存储字符串的列表
返回
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS7
词干
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS8
在给定字符串向量中词干的函数
参数
字符串列表:列表 列出存储字符串的列表
词干分析器:来自nltk.stem库的单词词干分析器; nltk.stem.snowballstemmer('english')默认值
返回
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pypip install SixAdsDS9
清洁工作
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函数的输出
规格:字典
存储用户、密码、主机和数据库键的字典 执行扩展名为.py的文件 文件:字符串
python文件的路径 添加参数:
正在执行的文件中使用的其他参数 读取.yml或.yaml文件 路径:字符串 将列表拆分为n个大小相等的列表 l:列表 n:int 返回列表或numpy数组的唯一元素的便捷函数 l:列表或数组
用于将数据下载并写入数据库的函数 处理下载数据的类 从Sixads数据库下载Google分类树的功能 连接:SQL逻辑连接对象 从给定部分构造查询并执行它的函数 选择部件:列表
标识所需列的字符串列表 来自部件:字符串
表名 其中部分:字符串
附加构造 处理写入数据的类 将数据写入所需的表 规格:字典
必须包含密钥用户、密码、主机和数据库 表格:字符串
引用要写入的表的字符串 数据:熊猫数据帧
要写入表中的数据 如果存在:字符串
如果表已经存在,该怎么办。可能的字符串值:
"替换"、"追加"、"失败" 用于处理单词嵌入的类 从TXT文档中读取单词embeddings并将其保存为字典 路径:字符串
包含单词embeddings的txt文档的路径 从给定的文本列表创建标记器 字符串列表:列表
包含字符串的列表 最大功能:int
标记器在内存中保存的最大唯一单词数 最大长度:int
字符串列表的所有元素都将进入的向量的长度
转换为。 函数创建嵌入矩阵以用于神经网络。这样下去
直接到嵌入层。 嵌入:字典
函数的load_输出 标记器:keras.tokenizer对象
tokenize_text()函数的输出 最大功能:int
要使用多少个唯一的标记 嵌入大小:int
嵌入有多少个坐标;默认值=300参数
返回
3
List with the same length as *string_list* where each word in each
string is lemmatized
exec_文件
4
List with the same length as *string_list* where each word in each
string is lemmatized
参数
返回
5
List with the same length as *string_list* where each word in each
string is lemmatized
阅读"yaml"
6
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
List with the same length as *string_list* where each word in each
string is lemmatized
大块n
9
List with the same length as *string_list* where each word in each
string is lemmatized
参数
返回
to_str(string_list)
0
独特
to_str(string_list)
1
参数
返回
to_str(string_list)
2
sixadsml.sql_实用程序
获取SQL
to_str(string_list)
3
获取谷歌树
to_str(string_list)
4
参数
返回
to_str(string_list)
5
获取数据
to_str(string_list)
6
参数
返回
to_str(string_list)
5
编写SQL
to_str(string_list)
8
to_str(string_list)
9
参数
sixadsml.嵌入
从文本加载
0
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
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
List with the same length as *string_list* where every list element
is converted to a str type object
参数
返回
5
List with the same length as *string_list* where every list element
is converted to a str type object
推荐PyPI第三方库