本文整理汇总了Python中spark.GenericScanner.tokenize方法的典型用法代码示例。如果您正苦于以下问题:Python GenericScanner.tokenize方法的具体用法?Python GenericScanner.tokenize怎么用?Python GenericScanner.tokenize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spark.GenericScanner
的用法示例。
在下文中一共展示了GenericScanner.tokenize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tokenize
# 需要导入模块: from spark import GenericScanner [as 别名]
# 或者: from spark.GenericScanner import tokenize [as 别名]
def tokenize(self, line):
"""
Create tokens from string.
@param line: string to scan
"""
self.rv = []
GenericScanner.tokenize(self, line)
return self.rv
示例2: tokenize
# 需要导入模块: from spark import GenericScanner [as 别名]
# 或者: from spark.GenericScanner import tokenize [as 别名]
def tokenize(self, input):
self.tokens = []
lines=input.split("\n")
for line in lines:
#remove inline comments
line=line.split("//")[0]
GenericScanner.tokenize(self, line)
self.lineno+=1
t=Token(type='NEWLINE',lineno=self.lineno)
self.tokens.append(t)
return self.tokens
示例3: tokenize
# 需要导入模块: from spark import GenericScanner [as 别名]
# 或者: from spark.GenericScanner import tokenize [as 别名]
def tokenize(self, input):
self.rv = []
GenericScanner.tokenize(self, input)
return self.rv
示例4: tokenize
# 需要导入模块: from spark import GenericScanner [as 别名]
# 或者: from spark.GenericScanner import tokenize [as 别名]
def tokenize(self, input, outputFile):
self.rv = []
self.outputFile = outputFile
GenericScanner.tokenize(self, input)
return self.rv
示例5: tokenize
# 需要导入模块: from spark import GenericScanner [as 别名]
# 或者: from spark.GenericScanner import tokenize [as 别名]
def tokenize(self, input):
self.rv = []
GenericScanner.tokenize(self, input)
self.line_count=0
return self.rv