Skip to content

Replace deprecated Microsoft Concept Graph API with ConceptNet; patch NLTK vulnerabilities#612

Merged
leestott merged 3 commits into
mainfrom
copilot/update-symbolic-api-endpoint
Feb 27, 2026
Merged

Replace deprecated Microsoft Concept Graph API with ConceptNet; patch NLTK vulnerabilities#612
leestott merged 3 commits into
mainfrom
copilot/update-symbolic-api-endpoint

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 27, 2026

The Microsoft Concept Graph REST API (concept.research.microsoft.com) is permanently down. The lessons/2-Symbolic/MSConceptGraph.ipynb notebook (and 54 translations) depended on it for is-a concept lookups. Additionally, all requirements*.txt files pinned vulnerable versions of nltk.

API Replacement — ConceptNet

Replaced the defunct MS Concept Graph API with ConceptNet, which provides equivalent IsA relations via a free, unauthenticated REST API.

Before:

def query(x):
    return json.loads(http(
        "https://concept.research.microsoft.com/api/Concept/ScoreByProb"
        "?instance={}&topK=10".format(urllib.parse.quote(x))
    ))

After:

def query(x):
    concept = x.lower().replace(' ', '_')
    url = "https://api.conceptnet.io/query?start=/c/en/{}&rel=/r/IsA&limit=10".format(
        urllib.parse.quote(concept))
    result = json.loads(http(url))
    edges = result.get('edges', [])
    total_weight = sum(edge['weight'] for edge in edges)
    return {edge['end']['label']: edge['weight'] / total_weight for edge in edges}
  • Edge weights are normalized to [0, 1], preserving compatibility with the existing > 0.1 threshold in the categorization loop
  • Fixed latent double-encoding bug: query(noun.replace(' ','%20'))query(noun) (encoding is now handled inside query())
  • Removed the ssl._create_unverified_context workaround (not needed for ConceptNet)
  • Cleared stale cached cell outputs
  • Applied identical code-cell changes across all 54 translation notebooks; updated example URLs in translated markdown cells

NLTK Security Patches

Upgraded nltk to 3.9.3 in all five requirements files to resolve:

CVE Affected versions File(s)
Unsafe deserialization < 3.9 all
Zip Slip <= 3.9.2 all
REDoS < 3.6.6 lessons/5-NLP/requirements-{pytorch,tf}.txt (were on 3.5)
Original prompt

This section details on the original issue you should resolve

<issue_title>lessons/2-Symbolic rest API endpoint times out</issue_title>
<issue_description>lessons/2-Symbolic
The https://concept.research.microsoft.com/api/Concept/ScoreByProb?instance={}&topK=10 as noted in the lesson documentation, times out and appears to either be down or non-functional</issue_description>

<agent_instructions>find a suitable replacement for lessons/2-Symbolic rest API endpoint as https://concept.research.microsoft.com/api/Concept/ScoreByProb?instance={}&topK=10 has been depreciated ideally the lesson theory should remain intact however the example needs updating</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@leestott Duplicate of #232 @leestott @carlotta94c I think we need to replace this msconcept is no longer available

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 27, 2026 06:58
…sons/2-Symbolic

Co-authored-by: leestott <2511341+leestott@users.noreply.github.com>
Co-authored-by: leestott <2511341+leestott@users.noreply.github.com>
Copilot AI changed the title [WIP] Update lessons/2-Symbolic API endpoint to a functional alternative Replace deprecated Microsoft Concept Graph API with ConceptNet; patch NLTK vulnerabilities Feb 27, 2026
@leestott leestott marked this pull request as ready for review February 27, 2026 07:09
@leestott leestott merged commit 8427513 into main Feb 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lessons/2-Symbolic rest API endpoint times out

2 participants