User:Denazz/Derived Terms Tool

import requests

def get_page_content(title): params = { 'action': 'query', 'format': 'json', 'titles': title, 'prop': 'revisions', 'rvprop': 'content', }

response = requests.get('https://en.wiktionary.org/w/api.php', params=params) data = response.json page = next(iter(data['query']['pages'].values), None)

if page and 'revisions' in page: return page['revisions'][0]['*']

def add_derived_terms(title, derived_terms): content = get_page_content(title) # Process the content to add derived terms # Update the content with the new derived terms # Make an edit using the API

base_word = 'example' new_derived_terms = ['example1', 'example2']
 * 1) Example usage

add_derived_terms(base_word, new_derived_terms)