文本文件解析 [英] text file parsing
问题描述
i有文本格式的文件
atom_trace(''emotion_response_level(a1,1.56072)'',emotion_response_level( a1,1.56072),[范围(49,50,真),范围(0,49,未知)]。
和
atom_trace(''goto(a1,a3)'',goto(a1,a3),[range(1,51,true),range(0,1,unknown)])。
i来解析这个文件。基本上我需要的是,我想提取,情绪反应水平,范围,真实和。请告诉我,我怎么解析它。
等待你的回复。
谢谢。
Ghazanfar
已删除
i have text file of the form
atom_trace(''emotion_response_level(a1, 1.56072)'', emotion_response_level(a1, 1.56072), [range(49, 50, true), range(0, 49, unknown)]).
and
atom_trace(''goto(a1, a3)'', goto(a1, a3), [range(1, 51, true), range(0, 1, unknown)]).
i heve to parse this file . Basically what i required is , i want to extract, emotion response level, range , true and . please tell, how i can parse it.
awaiting your reply.
thanks.
Ghazanfar
removed
推荐答案
hi,
i有文本文件格式
atom_trace(''emotion_response_level(a1,1.56072)'',emotion_response_level(a1,1.56072),[range(49,50,true) ),范围(0,49,未知)])。
和
atom_trace(''goto(a1,a3)'' ,goto(a1,a3),[range(1,51,true),range(0,1,unknown)])。
i来解析这个文件。基本上我需要的是,我想提取,情绪反应水平,范围,真实和。请告诉我,我怎么解析它。
等待你的回复。
谢谢。
Ghazanfar
s_ghazanfar@hotmail.com
我们可以为您提供帮助,但我们需要更多信息。你能告诉我们提取后数据应该如何显示吗?
例如:
We can help you with this, but we need some more information. Can you show us exactly how the data should appear after extraction?
e.g.:
像GhostDog74和bvdet这样的人真的给我一个关于我对模块的理解基本程度的线索,所以我想借此机会根据我的第一次接触来学习一些东西。
在这种情况下,我的第一个倾向是因为输入看起来如此结构化和一致,就是通过将所有非数据字符替换为as来将所有数据集中到列表中然后逐步分割结果,然后根据适当的索引值将它们转换为数字或其他任何内容。例如
Guys like GhostDog74 and bvdet really give me a clue as to how elementary my understanding of modules really is, so I''d like to take this opportunity to learn something based on how I first approached it.
In this case my first inclination because the input seems so structured and consistant would be to just grab all the data into a list by replacing all the non data characters with a space then splitting the result, then act on the appropriate index values converting them to numbers or whatever as I go. For example something like
我有这样的文本文件。
LeadsTo trace
atom_trace(''emotion_response_level(a1,1.56072)'',emotion_response_level(a1,1.76072),[range(49,50,true),range(0,49,unknown)]) 。
i可以用这种方式描述上面的文字:
a1(代理人)有emotion_response_level = 1.56072,这对应于范围(49,50,真的),类似地
a1(代理人)有emotion_response_level = 1.76072和tha t对应于范围(0,49,未知),现在稍后,我必须在我的程序中使用,代理a1具有emotion_response_level = 1.56072,因为它在愤怒中是真的(49,50,true)
即我必须选择与真实范围值相关的部分。
然后我还使用程序中的范围值。
atom_trace(''goto(a1,a3)'',goto(a1,a3),[range(1,51,true),range(0,1,unknown)])。
atom_trace(''agents_have_conversation(a1,a3,ajax)'',agents_have_conversation(a1,a3,ajax),[range(3,11,true),range(0,3,unknown)]) 。
ghazanfar
i have text file like this.
LeadsTo trace
atom_trace(''emotion_response_level(a1, 1.56072)'', emotion_response_level(a1, 1.76072), [range(49, 50, true), range(0, 49, unknown)]).
i can describe above line of text in this way:
a1(agent ) has emotion_response_level=1.56072 and that is correspond to range(49,50,true), similarly
a1(agent) has emotion_response_level=1.76072 and that is correspond to range(0,49,unknown), now later on, i have to use in my program that,the agent a1 has emotion_ response_level= 1.56072, because it is true in rage (49,50,true)
i.e. i have to select the portion related to true range values.
and then i have also use the vale of range in the program.
atom_trace(''goto(a1, a3)'', goto(a1, a3), [range(1, 51, true), range(0, 1, unknown)]).
atom_trace(''agents_have_conversation(a1, a3, ajax)'', agents_have_conversation(a1, a3, ajax), [range(3, 11, true), range(0, 3, unknown)]).
ghazanfar
这篇关于文本文件解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!