diff options
author | Vasil Zlatanov <v@skozl.com> | 2017-10-17 18:32:56 +0100 |
---|---|---|
committer | Vasil Zlatanov <v@skozl.com> | 2017-10-17 18:32:56 +0100 |
commit | 4e6f3cd37decb440d443cffd820d376ade0b72cd (patch) | |
tree | fc91ae910744544f4f7926fe2e4ce5d1d73c4df5 /wolfram/lat.py | |
parent | 8141b4227780faddc9672041bda60d84206b8422 (diff) | |
download | speech-4e6f3cd37decb440d443cffd820d376ade0b72cd.tar.gz speech-4e6f3cd37decb440d443cffd820d376ade0b72cd.tar.bz2 speech-4e6f3cd37decb440d443cffd820d376ade0b72cd.zip |
remove redundant files
Diffstat (limited to 'wolfram/lat.py')
-rw-r--r-- | wolfram/lat.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/wolfram/lat.py b/wolfram/lat.py deleted file mode 100644 index 92f31d1..0000000 --- a/wolfram/lat.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import requests -from urllib import quote_plus -import xml.etree.ElementTree as ET - -appid = 'U6E8UV-AP3QJAT6RK' - -def get_plaintext_query(latex): - r = requests.get('http://api.wolframalpha.com/v2/query?input=%s&appid=%s' % (quote_plus(latex), appid)) - root = ET.fromstring(r.text.encode('utf8')) - - for pod in root: - if pod.attrib.get('title', '') in ['Decimal approximation', 'Definite integral']: - subpod = pod.find('subpod') - result = subpod.find('plaintext').text - - if pod.attrib.get('title', '') == 'Definite integral': - return result.split('~~')[1] - else: - return result - -if __name__ == '__main__': - from sys import stdin - print get_plaintext_query(stdin.read()) |