Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <lja1fdF7i45U1@mid.individual.net>
Deutsch   English   Français   Italiano  
<lja1fdF7i45U1@mid.individual.net>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.mixmin.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rbowman <bowman@montana.com>
Newsgroups: comp.lang.python
Subject: Re: Script stops running with no error
Date: 29 Aug 2024 01:33:33 GMT
Lines: 55
Message-ID: <lja1fdF7i45U1@mid.individual.net>
References: <87r0a8xskb.fsf@rpi3>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net fsZN/tirJ3W/XY/J++WQGgG/ZIt+5peTGbh3PxACCw5wmXFQ4c
Cancel-Lock: sha1:vwYLXZ/jD9/Y9PmcR/OSKSTXmyc= sha256:9A4SMFI+ZCRG6Vrh/fMzl/L9xhOzTEgEm9igvXgwIdA=
User-Agent: Pan/0.149 (Bellevue; 4c157ba)
Bytes: 2507

On Wed, 28 Aug 2024 22:09:56 +0100, Daniel wrote:

>                 if definition:
>                     print(f"\n{word_type.capitalize()}\n")
>                     print("\n".join(definition))
>                     break

I don't know if that was intended but the 'break' kicks you out of 

        for word_type, pattern in cases.items():

I added a little debugging to show the cases iteration and commented out 
the break.  'noun' has five lines and appears to be correct. 'verb' has 
two lines, neither of which match the if/else.  The others aren't in the 
return from  https://api.wikimedia.org/core/v1/wiktionary/en/page/table. 

I have to admit I sometimes miss C where I can bounce between curlies.

Output:

python wiki.py

*** Definition for table ***

word_type noun   pattern:  \{en-noun\}(.*?)(?=\{|\Z)
line }
line # Furniture with a top surface to accommodate a variety of uses.
line ## An item of [[furniture]] with a [[flat]] [[top]] [[surface]] 
raised above the ground, usually on one or more legs.
line ##: ''Set that dish on the '''table''' over there, please.''
line ##*

Noun

1. Furniture with a top surface to accommodate a variety of uses.
   a. An item of furniture with a flat top surface raised above the 
ground, usually on one or more legs.

word_type verb   pattern:  \{en-verb\}(.*?)(?=\{|\Z)
line }
line #

word_type adjective   pattern:  \{en-adj\}(.*?)(?=\{|\Z)

word_type adverb   pattern:  \{en-adv\}(.*?)(?=\{|\Z)

word_type preposition   pattern:  \{en-prep\}(.*?)(?=\{|\Z)

word_type conjunction   pattern:  \{en-con\}(.*?)(?=\{|\Z)

word_type interjection   pattern:  \{en-intj\}(.*?)(?=\{|\Z)

word_type determiner   pattern:  \{en-det\}(.*?)(?=\{|\Z)

word_type pronoun   pattern:  \{en-pron\}(.*?)(?=\{|\Z)