Open tomsturges opened 2 years ago
Hi, currently this library is very simple. It just returns one python dictionary structure. To get the examples you need to access it through indexes like the following:
Access Examples of first part_of_speech (highlighted on the website with blue color followed by for example verb), the first translation (for all examples use for loop)
parser.search('run')['foreign_term'][0]['translation'][0]
# Returns [('I had to run really fast to catch the bus this morning.', 'Ich musste heute Morgen richtig schnell laufen, um den Bus noch zu erwischen.'), ('This power plant runs on biogas.', 'Dieses Kraftwerk läuft mit Biogas.')]
Example Code to get explore structure:
import pprint
from lingueeParser import linguee
parser = linguee.Linguee(("english", "german"))
pp = pprint.PrettyPrinter(indent=1)
pp.pprint(parser.search('run'))
Hello, could I kindly ask you if you would be able to explain how I access only the 'examples' with your code. In other words I would like to be able to write something like
parser.get_dictionary()['gut','examples']
and it would return[('Dieser Roman ist ein gutes Beispiel für Kinderliteratur.', "This novel is a fine example of children's literature.") .......
Thanks