# 需要导入模块: import string [as 别名]

# 或者: from string import ljust [as 别名]

def process_utterance(self, utt, make_label=True):

utt_data = []

utt_questions = defaultdict(int)

nodelist = utt.xpath(self.config["target_nodes"])

if nodelist == []:

print('WARNING: FeatureDumper\'s target_nodes matches no nodes: %s'%(self.config["target_nodes"]))

for node in nodelist:

self.htk_state_xpath = None ## make sure this is none.

self.start_time_xpath = None

self.end_time_xpath = None

## for phone!:--

node_data, node_questions = self.get_node_context_label(node)

statelist = node.xpath('.//'+self.state_tag)

assert statelist != []

for (i, state) in enumerate(statelist):

state_ix = i + 2

state_node_data = "%s[%s]"%(node_data, state_ix)

start_time = state.attrib.get(self.start_attribute, '_NA_') ## no time at runtime!

end_time = state.attrib.get(self.end_attribute, '_NA_')

if not (start_time=="_NA_" or end_time=="_NA_"):

start_time = string.ljust(str(ms_to_htk(start_time)), 10)

end_time = string.ljust(str(ms_to_htk(end_time)), 10)

state_node_data = "%s %s %s"%(start_time, end_time, state_node_data)

utt_data.append(state_node_data)

##utt_questions.update(node_questions)

## Sum the dictionaries' values:

for question in node_questions:

utt_questions[question]+=node_questions[question]

if make_label:

label_file = utt.get_filename(self.config["output_filetype"])

writelist(utt_data, label_file, uni=True)

return (utt_data, utt_questions) ## for writing utterance-level labels,

## these returned values will be ignored. But these can be used to

## acccumulate questions and features over the whole corpus for

## training (see train() method).

python len ljust_Python string.ljust方法代码示例相关推荐

  1. python中string.digits_Python string.hexdigits方法代码示例

    本文整理汇总了Python中string.hexdigits方法的典型用法代码示例.如果您正苦于以下问题:Python string.hexdigits方法的具体用法?Python string.he ...

  2. python中uppercase是什么意思_Python string.uppercase方法代码示例

    本文整理汇总了Python中string.uppercase方法的典型用法代码示例.如果您正苦于以下问题:Python string.uppercase方法的具体用法?Python string.up ...

  3. python中uppercase是什么意思_Python string.ascii_uppercase方法代码示例

    本文整理汇总了Python中string.ascii_uppercase方法的典型用法代码示例.如果您正苦于以下问题:Python string.ascii_uppercase方法的具体用法?Pyth ...

  4. python中summary_Python summary_pb2.Summary方法代码示例

    本文整理汇总了Python中tensorflow.core.framework.summary_pb2.Summary方法的典型用法代码示例.如果您正苦于以下问题:Python summary_pb2 ...

  5. python里defoults_Python Part.Compound方法代码示例

    本文整理汇总了Python中Part.Compound方法的典型用法代码示例.如果您正苦于以下问题:Python Part.Compound方法的具体用法?Python Part.Compound怎么 ...

  6. python中weekday_Python calendar.weekday方法代码示例

    本文整理汇总了Python中calendar.weekday方法的典型用法代码示例.如果您正苦于以下问题:Python calendar.weekday方法的具体用法?Python calendar. ...

  7. python clr createinstance_Python System.Byte方法代码示例

    本文整理汇总了Python中System.Byte方法的典型用法代码示例.如果您正苦于以下问题:Python System.Byte方法的具体用法?Python System.Byte怎么用?Pyth ...

  8. g的python实现_Python flask.g方法代码示例

    本文整理汇总了Python中flask.g方法的典型用法代码示例.如果您正苦于以下问题:Python flask.g方法的具体用法?Python flask.g怎么用?Python flask.g使用 ...

  9. python使用loaddata_Python data.load方法代码示例

    本文整理汇总了Python中data.load方法的典型用法代码示例.如果您正苦于以下问题:Python data.load方法的具体用法?Python data.load怎么用?Python dat ...

最新文章

  1. MinGW安装与使用简介
  2. linux命令学习之 cp(命令学习之四)
  3. 【Java 注解】自定义注解 ( 元注解 )
  4. 第8章例题 6-4 输入年份和天数,输出对应的年、月、日
  5. 基于Xml 的IOC 容器-载入<bean>元素
  6. Android消息传递之EventBus 3.0使用详解
  7. Android 编码规范:(七)避免使用终结方法
  8. icmp基于tcp还是udp_imi -- 基于PHP协程应用开发框架,支持WebSocket,TCP,UDP应用开发...
  9. RUBY常用类库文档翻译以及使用示例
  10. MyBatis的基本增删改查及条件操作及main方法调用
  11. window10运行不了1stopt_函数模型分析画图软件-1stopt非线性拟合工具Win10专业版1.7免费版 - 维维软件园...
  12. 微信小程序SEO排名优化
  13. 最大流算法之Dinic
  14. 口袋小精灵JAVA版下载_口袋小精灵200合一
  15. java太阳系论文摘要_毕业论文摘要
  16. 纯CSS实现手风琴效果(附演示)
  17. 2021MySQL面试题
  18. 全方位掌握 NSIS 的操作
  19. 电脑计算机不显示桌面了怎么办,电脑不显示桌面黑屏了 电脑黑屏不显示桌面怎么办 - 云骑士一键重装系统...
  20. leetcode 二分法 最大值最小化/最小值最大化

热门文章

  1. 图书《图像并行处理技术》简介
  2. 如何把 DropDownList 某一个 Item 的 Text 改成粗体 ?
  3. 现代谱估计:Blackman-Tukey 相关图
  4. Hough Transform 的算法思想
  5. tensorflow调用问题解决
  6. php localtion,详解Nginx Location配置
  7. [云炬创业基础笔记]第九章企业的法律形态测试8
  8. VTK修炼之道64:纹理映射体绘制_三维纹理映射
  9. [骨科手术导航]2D/3D医学图像配准研究_罗博博_南方科技大学
  10. 一个比较完整的Inno Setup 安装脚本