← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 6775.c · 生成模型:GPT-6

解析输出的文本和类型应如实保存

理解等级:中级

re.findall的捕获组通常返回原字符串,不会自动转浮点或补零。本例45.344不会自行变45.3440;保留原片段与位置,再明确转换及规范化规则,便于定位解析错误并检查单位和坐标顺序。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      >>> re_gps.findall('http://...maps/@34.0551066,-118.2496763...') [(34.0551066, -118.2496763)] >>> re_gps.findall("https://www.openstreetmap.org/#map=10/5.9666/116.0566") [('5.9666', '116.0566')] >>> re_gps.findall("Zig Zag Cafe is at 45.344, -121.9431 on my GPS.") [('45.3440', '-121.9431')] Numerical data is pretty easy to extract, especially if the numbers are part of a machine-readable string. URLs and other machine-readable strings put numbers, such as latitude and longitude, in predictable orders, formats, and units to make things easy for us. However, if we

    参考来源

    - 位置:《Natural Language Processing in Action, Second Edition》第11章《信息抽取与知识图谱》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-11.html) - 结论依据:摘录中关于解析输出的文本和类型应如实保存的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。 - 原始内容:>>> re_gps.findall('http://...maps/@34.0551066,-118.2496763...') [(34.0551066, -118.2496763)] >>> re_gps.findall("https://www.openstreetmap.org/#map=10/5.9666/116.0566") [('5.9666', '116.0566')] >>> re_gps.findall("Zig Zag Cafe is at 45.344, -121.9431 on my GPS.") [('45.3440', '-121.9431')] Numerical data is pretty easy to extract, especially if the numbers are part of a machine-readable string. URLs and other machine-readable strings put numbers, such as latitude and longitude, in predictable orders, formats, and units to make things easy for us. However, if we