The Anacode Toolkit: aggregation and visualization of API outputs¶
The Anacode Toolkit is our open-source python library which simplifies your work with the Web&Text API. It handles HTTPS communication with the server, converts JSON output into table structures and offers various options for aggregation and visualization of the results. The library is based on the python pandas framework.
Here is an example of how to query our server and store results to .csv files on disk:
>>> from anacode.api import client >>> with client.analyzer('<your token>', 'target/dir') as api: >>> for document in your_data: >>> api.categories(document) >>> api.absa(document)
To perform one of the supported aggregations, you simply load the data and call the corresponding aggregation method. For instance, let’s check the five features that most frequently co-occur with the feature VisualAppearance in our (fictive) dataset:
>>> from anacode.agg import DatasetLoader >>> dataset = DatasetLoader.from_path('target/dir') >>> concepts = dataset.concepts >>> result = concepts.co_occurring_concepts('VisualAppearance', n=5, >>> concept_type='feature') >>> result
Feature Interior 33 Body 26 Comfort 17 Space 17 RearEnd 16 Name: Count, dtype: int64
We now use the plotting functionality to produce the corresponding visualization:
>>> from anacode.agg import plotting >>> plotting.plot(result)
The full documentation of the library is hosted on readthedocs. The tutorial Combined use case: concepts and sentiments for BMW 7, Audi A8 and MB S-Class illustrates the usage of the toolkit on a real-world usecase.