Git Product home page Git Product logo

cwb-cads's Introduction

cwb-cads: CWB-based API for Corpus-Assisted Discourse Studies

  • implemented in Python/APIFlask

  • uses cwb-ccc for connecting to the CWB

    • CWB must be installed
    • corpora must be imported via cwb-encode
    • no further corpus installation needed (TODO: creating s-att tables)
  • MMDA backend available via cwb-cads/mmda/

    • JWT authorization
    • dedicated to old vue.js frontend

Development

  • use makefile for testing and development

    make install
    make init
    make run
    make test
    
  • we use Apache in production

    • install Apache
      sudo apt install apache2 apache2-dev
      
    • install Apache mod for WSGI daemon
      sudo apt install libapache2-mod-wsgi-py3
      
  • install mod_wsgi in virtual environment

    . venv/bin/activate && pip install mod_wsgi
    
  • set group of root directory to www-data and make files accessible for group

    sudo chgrp www-data -R cwb-cads/
    sudo find ./ -type d -exec chmod 755 -R {} \;
    sudo find ./ -type f -exec chmod 644 {} \;
    sudo chmod -R g+w cwb-cads/instance/
    
  • make sure that root directory can be served by Apache

    • NB: all parent directories must be accessible by www-data (e.g. chmod o+rx /home/<USER>/)
  • add the following to /etc/apache2/sites-enabled/<HOSTS>.conf

    <Virtualhost ...>
    
        ...
        
        WSGIDaemonProcess cwb-cads user=www-data group=www-data threads=4 python-home=/<PATH-TO-CWB-CADS>/venv locale='C.UTF-8'
        WSGIScriptAlias /cwb-cads /<PATH-TO-CWB-CADS>/cwb-cads.wsgi
        WSGIPassAuthorization on
        
        <Directory /<PATH-TO-CWB-CADS/>
      	WSGIProcessGroup cwb-cads
      	WSGIApplicationGroup %{GLOBAL}
      	Order deny,allow
      	Require all granted
        </Directory>
      
        ...
        
    </Virtualhost>
  • restart Apache

    sudo service apache2 restart
    

Features

CADS features

  • query
  • breakdown
  • concordance
  • collocation analysis
  • keyword analysis
  • anchored queries
  • subcorpus creation
  • meta distribution

MMDA features

  • discoursemes
    • creation
    • query / collocation analysis
    • meta distribution
  • discourseme constellations
    • pairwise discourseme associations
    • visualisation
    • definition via optional and obligatory discoursemes
    • meta distribution
    • secondary collocates
  • semantic map
    • automatic visualisation of n-best lists (keywords, collocates)
    • manual arrangement
    • projection (including new items in created map)
    • interactive drag & drop for discourseme creation

current issues

bugfix

  • quick-conc without s-att
  • deleting discourseme → deleting collocations where discourseme is filter
  • no results → network error; but empty discourseme is added
  • few results → no collocates table → netwerk error

performance:

  • quick-conc ain't quick enough
  • create all window counts separately
  • regenerate: delete all collocation items, create for given window size

semantic map

  • discourseme positions: automatically move items towards center of manual positions
  • new items: move away from center

code sanity

  • move second order collocation to ccc_collocates

test

  • top-level methods only

test cases

collocation analysis workflow

create collocation (constellation: one filter discourseme, no highlight discoursemes)

  • get breakdown
  • get collocation
  • get concordance

create discourseme

  • create discourseme from two items

  • add discourseme to highlight discoursemes

  • get concordance lines

delete discourseme

  • delete discourseme from highlight discoursemes

change discourseme

  • delete item from discourseme
  • add item to discourseme

cwb-cads's People

Contributors

ausgerechnet avatar

Stargazers

 avatar

Watchers

 avatar

cwb-cads's Issues

Creating a new query with invalid CQP query string causes server error and invalid data

Adding a new Query using POST /queries/ with an certain values for cqp_query can cause a 500 error response. I assume the culprit is an invalid CQP query that cannot be executed.
GET /queries/ will then return an additional entry. This new entry however is malformed, because cqp_nqr_matches will be null which does not adhere to our OpenAPI spec.

Expected behavior

Server responds with a 404.
Ideally the response also contains a meaningful error message about what the issue with the query is.

Steps to reproduce

  1. Make a POST request to /queries/ with a nonsense value for cqp_query.
    e.g.:
curl -X 'POST' \
'https://corpora.linguistik.uni-erlangen.de/cwb-cads-dev/query/?execute=true' \
-H 'accept: application/json' \
-H 'Authorization: Bearer AUTH_TOKEN_GOES_HERE \
-H 'Content-Type: application/json' \
-d '{
"corpus_id": 1,
"cqp_query": "!!I_Am_Invalid!!",
"match_strategy": "longest",
"s": "s"
}'
  1. Inspect the response from GET /queries/ and check for cqp_nqr_matches: null

Return query Id on shuffle endpoint

I forgot to specify that when we talked about it, my bad:
The return value of POST /query/{query_id}/concordance/shuffle should contain the query Id.
e.g. ConcordanceShuffleOut { query_id: int }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.