wosecopy: WOrd SEntence COoccurrence
wosecopy is a Python package for extracting and analyzing concept associations in creative stories using natural language processing and network analysis.
Overview
wosecopy identifies semantic relationships between concepts across consecutive sentences to understand narrative flow and creativity. It extracts noun-based concepts, matches them using word embeddings, builds network graphs, and calculates various metrics to quantify story structure.
Key Features
Bilingual Support: Process both English and German text
Concept Extraction: Extract noun-based concepts using spaCy
Semantic Matching: Link concepts using word embeddings similarity
Network Analysis: Calculate 6 key metrics (ASPL, MLCC, Modularity, etc.)
Creativity Analysis: Measure concept “unexpectedness”
Visualization: Generate network graphs and statistical plots
CLI Tools: Complete command-line interface
Export Formats: GraphML, GEXF, GML
Quick Start
Installation
pip install wosecopy
python -m spacy download en_core_web_lg
Basic Usage
Command Line:
# Extract concepts from stories
wosecopy extract stories.csv -o results.csv
# Calculate network metrics
wosecopy metrics results.csv -o metrics.json
# Visualize a concept network
wosecopy visualize results.csv -o graph.png
Python API:
from wosecopy import wosecopyExtractor, build_graph, calculate_all_metrics
# Extract concepts
extractor = wosecopyExtractor(language='en')
df = extractor.process_csv('stories.csv')
# Build and analyze graph
concepts = df['wosecopy_concepts'][0]
graph = build_graph(concepts)
metrics = calculate_all_metrics(graph)
Contents
User Guide
API Reference
Additional Information