Software
stance-llm: A Python package to classify stances of entities in text, using large language models
In the sustainability.discourses Project, we have recently developped a Python package to leverage large language models to classify stances of entities in German text.
Check it out here, it’s also on PyPi..
Here’s a quick sample:
-llm
pip install stance pip install guidance
1from guidance import models
from stance_llm.process import detect_stance
2= models.Transformers("DiscoResearch/DiscoLM_German_7b_v1")
disco7b
= [
my_eg "text":"Emily will LLMs in den Papageienzoo sperren und streng beaufsichtigen.",
{"ent_text": "Emily",
3"statement": "LLMs sollten in den Papageienzoo gesperrt werden."}]
= detect_stance(
classification = my_eg,
eg = disco7b,
llm 4= "is"
chain_label
)
classification.stance
- 1
- stance-llm relies on guidance
- 2
- Choose an LLM accessible through guidance (Transformers, LlamaCpp, OpenAI)
- 3
- The task format
- 4
- This is where you can choose a prompt chain
motifr: An R package to study multi-level network motifs
Together with the phenomenal Tim Seppelt, I have implemented an R package to analyse multi-level networks in terms of motifs.
All up to data information on the package can be found on the package homepage: https://marioangst.github.io/motifr/
Multi-level networks combine multiple networks in one representation, e.g. social-ecological networks, which connect a social network (e.g. interactions among fishermen) with an ecological network (e.g. interactions between fish species) and the ties in between (e.g. fishers who fish specific species).
Motifs are small configurations of nodes and edges (subgraphs) within an overall network.
Package features include:
- Visualization: The package provides functions to visualize multi-level networks, based on ggraph.
- Motif counts: The package is in many parts a R wrapper for the excellent SESMotifAnalyser Python framework written by Tim Seppelt to count multi-level network motifs, compare them to a baseline and much more.
- Contributions of edges to motifs: motifr further identifies and visualizes functional gaps and critical edges in multi-level networks based on contributions of existing or potential edges to given motifs (this is theoretically motivated by network theories of functional fit and misfit).
MToolR: A companion package to the mental modeling tool M-Tool
MToolR is a companion package I have developed for the Mental Model Mapping Tool M-Tool (https://www.m-tool.org/) by Karlijn van den Broek. The package provides: a) functionality to load and process data generated by M-Tool b) procedures for common (basic) analytical tasks c) visualization functions.
Package homepage: https://marioangst.github.io/MToolR/