featuretools.primitives.NumberOfHashtags#

class featuretools.primitives.NumberOfHashtags[source]#

确定字符串中的话题标签数量.

Description:

给定一个字符串列表,确定每个字符串中的话题标签数量.

话题标签定义为满足以下条件的字符串:
  • 以’#’字符开头,后跟至少包含一个字母字符的字母数字字符序列

  • 出现在字符串的开头或空白字符之后

  • 以字符串的结束、空白字符或除’#’以外的标点符号字符终止
    • 例如,字符串’#yes-no’包含一个有效的话题标签(‘#yes’)

    • 例如,字符串’#yes#’不包含有效的话题标签

此实现处理Unicode字符.

此实现不对话题标签的字符数施加任何限制.

如果字符串缺失,返回`NaN`.

Examples

>>> x = ['#regular #expression', 'this is a string', '###__regular#1and_0#expression']
>>> number_of_hashtags = NumberOfHashtags()
>>> number_of_hashtags(x).tolist()
[2.0, 0.0, 0.0]
__init__()[source]#

Methods

__init__()

flatten_nested_input_types(input_types)

将嵌套的列模式输入展平成一个列表.

generate_name(base_feature_names)

generate_names(base_feature_names)

get_args_string()

get_arguments()

get_description(input_column_descriptions[, ...])

get_filepath(filename)

get_function()

process_text(text)

Attributes

base_of

base_of_exclude

commutative

default_value

Default value this feature returns if no data found.

description_template

input_types

woodwork.ColumnSchema types of inputs

max_stack_depth

name

Name of the primitive

number_output_features

Number of columns in feature matrix associated with this feature

return_type

ColumnSchema type of return

stack_on

stack_on_exclude

stack_on_self

uses_calc_time

uses_full_dataframe