Skip to content

Implement friend recommendations based on shared programming languages - #328

Open
konard wants to merge 3 commits into
mainfrom
issue-60-dfe20876
Open

Implement friend recommendations based on shared programming languages#328
konard wants to merge 3 commits into
mainfrom
issue-60-dfe20876

Conversation

@konard

@konard konard commented Sep 13, 2025

Copy link
Copy Markdown
Member

Summary

  • ✅ Implemented new "friends" command that recommends users based on shared programming languages
  • ✅ Added support for Russian and English command variants ("друзья", "friends", "рекомендации", "recommendations")
  • ✅ Developed algorithm that sorts recommendations by number of shared languages then by karma
  • ✅ Added comprehensive message formatting with shared languages display
  • ✅ Included message length truncation for VK API limits
  • ✅ Added unit tests for the new functionality

Technical Implementation

New Command Pattern

Added FRIENDS_RECOMMENDATIONS pattern in python/patterns.py that accepts:

  • "друзья" / "friends"
  • "рекомендации" / "recommendations"
  • Optional number parameter to limit results (default: 10)

Algorithm Logic

  1. Gets current user's programming languages
  2. Searches all users in the chat for shared programming languages
  3. Calculates compatibility score based on number of shared languages
  4. Sorts by shared language count (descending), then by karma (descending)
  5. Returns formatted recommendations with shared languages highlighted

Files Modified

  • python/patterns.py: Added FRIENDS_RECOMMENDATIONS pattern
  • python/modules/commands.py: Implemented friends_recommendations method
  • python/modules/commands_builder.py: Added build_friends_recommendations method
  • python/__main__.py: Registered the new command
  • python/tests.py: Added unit tests
  • experiments/test_friend_recommendations.py: Added standalone test suite

Test Plan

  • Syntax validation of all modified Python files
  • Unit tests added to existing test suite
  • Algorithm logic verified with standalone test script
  • Message formatting and truncation tested
  • Edge cases handled (no languages, no matches, etc.)

Usage Examples

друзья           # Get top 10 friend recommendations
friends 5        # Get top 5 friend recommendations  
рекомендации 3   # Get top 3 friend recommendations
recommendations  # Get top 10 friend recommendations

Sample Output

🤝 Рекомендации друзей (ваши языки: JavaScript, Python):

1. [id123|Иван] (karma: 50) - github.com/ivan - общие: Python, JavaScript (2)
2. [id456|Мария] (karma: 30) - общие: Python (1)
3. [id789|Петр] (karma: 25) - github.com/peter - общие: JavaScript (1)

Fixes #60

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #60
@konard konard self-assigned this Sep 13, 2025
This commit addresses issue #60 by adding a new "friends" command that recommends
users based on the number of shared programming languages.

Features:
- New command pattern accepting "друзья", "friends", "рекомендации", or "recommendations"
- Algorithm that finds users with common programming languages
- Sorting by number of shared languages (descending) then by karma (descending)
- Optional parameter to limit the number of recommendations (default: 10)
- Comprehensive message formatting with shared languages display
- Message length truncation for VK API limits

Files modified:
- python/patterns.py: Added FRIENDS_RECOMMENDATIONS pattern
- python/modules/commands.py: Implemented friends_recommendations method
- python/modules/commands_builder.py: Added build_friends_recommendations method
- python/__main__.py: Registered the new command
- python/tests.py: Added unit tests for the new functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] List of friends recommendations based on the number of equal programming languages Implement friend recommendations based on shared programming languages Sep 13, 2025
@konard
konard marked this pull request as ready for review September 13, 2025 23:33
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.

List of friends recommendations based on the number of equal programming languages

1 participant