Skip to content

Repository files navigation

ASC-analyzer

End-to-end Analyses of English ASCs with a Supervised Learning-based ASC Tagger

PyPI Downloads

ASC analyzer workflow

Installation

To ensure stability, I recommend installing dependencies in the following order:

  1. Install spaCy:

    pip install spacy
  2. Install spaCy-transformers:

    pip install spacy-transformers
  3. Download the transformer-based spaCy model:

    python -m spacy download en_core_web_trf
  4. Install the ASC analyzer package:

    pip install asc-analyzer 

Quick start

  • Note: The package name on PyPI is asc-analyzer, but the internal Python module is asc_analyzer.
  • Prepare a directory with .txt files. Each file should contain plain English text.

Then run the analyzer using:

  • Option 1. Save summary statistics as a csv
python3 -m asc_analyzer.cli \
  --input-dir "/path/to/texts" \
  --output-csv "/path/to/output.csv" \
  --source "cow"    # or "subt"
  • Option 2. Save ASC-tagged text files
python3 -m asc_analyzer.cli \
  --input-dir "/path/to/texts" \
  --save-asc-output \  # Saves ASC-tagged files in the same directory as the input
  --source "cow"
  • Assign ASC tags to each sentence
  • Print the ASC-tagged results directly to the terminal (--print-asc)
  • Save token-level ASC tagging results as *_ASCinfo.txt files (--save-asc-output)
  • Compute ASC usage statistics (e.g., diversity, proportion, frequency, and verb–ASC association strength) and save them in a CSV summary file
  • The --source option determines which reference corpus is used for computing frequency and association measures:
    • cow: uses the EnCOW corpus (web-based, written English)
    • subt: uses the SUBTLEX corpus (subtitle-based, [transcribed] spoken English)
    • Choose the source based on the register that best matches your input data.

Options

To view all available options and flags, run:

python3 -m asc_analyzer.cli --help
Option Description
--input-dir Directory containing .txt files to process (default: asc_analyzer/data/test)
--output-csv Path to save the resulting CSV (default: Written_COW.csv or Spoken_SubT.csv)
--source Reference dataset: cow (written, default) or subt (spoken)
--indices Comma-separated list of index names to include in the CSV (default: all standard indices)
--save-asc-output Save ASC-tagged outputs as *_ASCinfo.txt in the input directory
--print-asc Print ASC-tagged results to the terminal

Output for --print-asc

When using the --print-asc option, the ASC Analyzer prints token-level tagging results directly to the terminal in a tabular format.

python3 -m asc_analyzer.cli \
  --input-dir "/path/to/texts" \
  --print-asc

Example output:

# sent_id = 1
1	The	the	
2	idea	idea	
3	is	be	ATTR
4	trust	trust	

You can save this output to txt files by including --save-asc-output (as shown in Option 2 of the Quickstart section).

Citation

License

This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

About

A tool for analyzing ASC usage in English texts

Resources

Stars

Watchers

Forks

Contributors

Languages