Skip to content

A new package that takes user-provided text descriptions of transportation or infrastructure maps (like train networks) and returns structured feedback or improvements. It analyzes the input for key e

Notifications You must be signed in to change notification settings

chigwell/transitmaplint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

transitmaplint

PyPI version License: MIT Downloads LinkedIn

transitmaplint is a lightweight toolkit that takes a plain‑text description of a transportation or infrastructure map—such as a train network or bus route diagram—and returns a structured, concise critique.
The output is designed to be easy to consume programmatically or to present back to designers as quick, automated feedback.

Author: Eugene Evstafev
Email: hi@euegne.plus
GitHub: chigwell


Features

  • Route clarity assessment – Detects ambiguous terminologies and missing links in the textual map.
  • Station / stop naming – Flags inconsistent naming, duplicate names, or overly long labels.
  • Layout suggestions – Provides high‑level recommendations on how to reorder or group routes.
  • Consistent response format – The function always returns a Python list of strings, each string being one feedback item.

The package leverages the open‑source LangChain framework to query an LLM. Out‑of‑the‑box it uses ChatLLM7 from the langchain_llm7 package, but you can freely supply any LangChain chat model (OpenAI, Anthropic, Google, etc.).


Installation

pip install transitmaplint

transitmaplint pulls in its dependencies automatically:

  • langchain-core
  • langchain-llm7 (default LLM provider)
  • llmatch_messages

Quick Start

from transitmaplint import transitmaplint

# Sample map description
user_input = """
Route A: Station 1 -> Station 2 -> Station 3
Route B: Station 3 -> Station 4 -> Station 5
"""

feedback = transitmaplint(user_input)

for i, item in enumerate(feedback, 1):
    print(f"{i}. {item}")

The output will be a list of feedback strings such as:

1. Route B shares Station 3 with Route A – consider adding a buffer station.
2. Station names are concise, but "Station 1" and "Station 2" could be more descriptive.
3. The overall layout flows linearly; adding a cross‑link between Route A and Route B at Station 3 would improve connectivity.

Advanced Usage – Providing Your Own LLM

The transitmaplint function accepts an optional llm argument that can be any instance of langchain_core.language_models.BaseChatModel.
Below are examples of using popular providers.

OpenAI

from langchain_openai import ChatOpenAI
from transitmaplint import transitmaplint

llm = ChatOpenAI()  # configure as needed (API key, model, etc.)
feedback = transitmaplint(user_input, llm=llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from transitmaplint import transitmaplint

llm = ChatAnthropic()
feedback = transitmaplint(user_input, llm=llm)

Google Generative AI

from langchain_google_genai import ChatGoogleGenerativeAI
from transitmaplint import transitmaplint

llm = ChatGoogleGenerativeAI()
feedback = transitmaplint(user_input, llm=llm)

Configuration – LLM7 API Key

If you want to use the default ChatLLM7 but with a higher rate limit or a personal key:

export LLM7_API_KEY="your-ultra-key-here"

or pass it directly:

feedback = transitmaplint(user_input, api_key="your-ultra-key-here")

The free tier of LLM7 is usually sufficient for most small‑to‑medium map checks.

Getting an LLM7 key – Register for free at LLM7.


Supported Return Type

List[str]

Each item in the list is a well‑structured sentence. The function guarantees that the returned data matches the regex pattern defined internally (pattern from transitmaplint.prompts). This makes it straightforward to iteratively parse or store feedback.


Development & Issues

  • Issues, feature requests, and discussion:

  • License

    MIT License – feel free to use, modify, and distribute.


    Want to contribute? Fork the repository, create a new feature branch, and open a pull request. We're happy to receive documentation, new prompt templates, or improvements to the regex checking logic.

    Releases

    No releases published

    Packages

    No packages published

    Languages