当前位置: 首页>>代码示例>>Python>>正文


Python pydelicious.get_popular函数代码示例

本文整理汇总了Python中pydelicious.get_popular函数的典型用法代码示例。如果您正苦于以下问题:Python get_popular函数的具体用法?Python get_popular怎么用?Python get_popular使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_popular函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_tag_matrix

def build_tag_matrix(tags):
    """
    Given a list of bookmarks returns a matrix with
    tags as columns and urls as rows.

    Returns: tags, urls, matrix
    """
    bookmarks = []
    for tag in tags:
        marks = get_popular(tag=tag)
        for bookmark in marks:
            url = bookmark["url"]
            tags = bookmark["tags"]
            bookmarks.append({"url": url, "tags": tags})

    tag_list = set(tag for tag in bookmark["tags"] for bookmark in bookmarks)
    url_list = []
    matrix = []
    for bookmark in bookmarks:
        row = []
        for tag in tag_list:
            row.append(1 if tag in bookmark["tags"] else 0)
        url_list.append(bookmark["url"])
        matrix.append(row)
    return tag_list, url_list, matrix
开发者ID:damianofusco,项目名称:Programming-Collective-Intelligence,代码行数:25,代码来源:ex1.py

示例2: initializeUserDict

def initializeUserDict(tag, count = 5):
    usr_dict = {}
    for most_popular in get_popular(tag = tag)[0 : count]:
        for person in get_urlposts(most_popular['href']):
            usr = person['user']
            usr_dict[usr] = {}
    return usr_dict
开发者ID:Com-Mean,项目名称:prog_collective_intel,代码行数:7,代码来源:deliciousrec.py

示例3: initializeUserDict

def initializeUserDict(tag,count=5):
    user_dict = {}
    all_items = {}
    # get the top count' popular posts
    for p1 in get_popular(tag=tag)[0:count]:
        # find all users who posted this
        for p2 in get_urlposts(p1['href']):
            user = p2['user']
            user_dict.setdefault(user,{})
            # get user posts
            for i in range(3):
                try:
                    posts = get_userposts(user)
                    break
                except:
                    print "Failed user "+user+", retrying"
                    time.sleep(4)
            for post in posts:
                url = post['href']
                user_dict[user][url] = 1.0
                all_items[url] = 1

    #fill in missing items with 0
    [ratings.setdefault(item,0.0) for item in all_items for ratings in user_dict.values()]
                
    return user_dict
开发者ID:adgaudio,项目名称:kaggle-wordpress,代码行数:26,代码来源:deliciousrec.py

示例4: initialize

def initialize(tag,count=5):
    user_dict = {}
    for p1 in get_popular(tag=tag)[0:count]:
        for p2 in get_urlposts(p1['url']):
            user = p2['user']
            user_dict[user] = {}
    return user_dict
开发者ID:Anmol2307,项目名称:Algorithms,代码行数:7,代码来源:delicious.py

示例5: initializeUserDict

def initializeUserDict(tag, count=5):
    user_dict = {}
    for p1 in get_popular(tag=tag)[0:count]:
        for p2 in get_urlposts(p1["url"]):
            user = p2["user"]
            user_dict[user] = {}
    return user_dict
开发者ID:rogeralmeida,项目名称:programming-collective-intelligence-source,代码行数:7,代码来源:deliciousrec.py

示例6: initializeUserDict

def initializeUserDict(tag ,count = 5):
	user_dict = {}
	#get the top count popular posts
	for p1 in get_popular(tag = tag)[0:count]:
		for p2 in get_urlposts(p1['url']):
			user = p2['user']
			user_dict[user] = {}
	return user_dict
开发者ID:saifmahamood,项目名称:Recommender-system,代码行数:8,代码来源:recommendations.py

示例7: initializeUserDict

def initializeUserDict(tag, count=5):
    user_dict={}
    # 获取前count个最受欢迎的张
    for p1 in get_popular(tag = tag)[0:count]:
        for p2 in get_urlposts(p1['href']):
            user=p2['user']
            user_dict[user] = {}
    return user_dict
开发者ID:Andor-Z,项目名称:My-Learning-Note,代码行数:8,代码来源:deliciousrec.py

示例8: initlizeUserDict

def initlizeUserDict(tag, count = 5):
    user_dict = {}
    #获取所有用户都提交过的链接

    for p1 in get_popular(tag=tag)[0:count]:
        for p2 in get_urlposts(p1['href']):
            user = p2['user']
            user_dict[user]={}
    return user_dict
开发者ID:nightswatchs,项目名称:Machine-Learning,代码行数:9,代码来源:deliciousrec.py

示例9: initialize_user_dict

def initialize_user_dict(tag,count=5):
    user_dict={}
    # Get the top "count" popular posts
    for p1 in pydelicious.get_popular(tag=tag)[0:count]:
        # Find all users who posted the same post url
        for p2 in pydelicious.get_urlposts(p1['url']):
            user=p2['user']
            user_dict[user]={}
    return user_dict
开发者ID:rfguri,项目名称:link-recommender,代码行数:9,代码来源:deliciousrec.py

示例10: initialize_user_dict

def initialize_user_dict(tag, count=5):
	user_dict = {}
	# Get the top count popular post
	for p1 in get_popular(tag=tag)[0:count]:
		# Find all users who posted this
		for p2 in get_urlposts(p1['url']):
			user=p2['user']
			user_dict[user] = {}
	return user_dict
开发者ID:ZachOrr,项目名称:programming-collective-intelligence,代码行数:9,代码来源:deliciousrec.py

示例11: initializeUserDict

def initializeUserDict(tag,count=5):
  user_dict={}
  # count개의 인기 게시물을 얻음
  for p1 in get_popular(tag=tag)[0:count]:
    # 이 게시물을 올린 모든 사용자를 얻음
    for p2 in get_urlposts(p1['href']):
      user=p2['user']
      user_dict[user]={}
  return user_dict
开发者ID:freebz,项目名称:lp-Programming-Collective-Intelligence,代码行数:9,代码来源:deliciousrec.py

示例12: initializeUserDict

def initializeUserDict(tag,count = 5):
    user_dict = {}
    #获取前count个最受欢迎的链接张贴记录
    for p1 in  get_popular(tag=tag)[0:count]:
        #查找所有张贴记录的用户
        for p2 in get_urlposts(p1['url']):
            user = p2['user']
            user_dict[user] = {} #得到一个包含用户的空字典
    return  user_dict
开发者ID:SamanthaChen,项目名称:MLPython,代码行数:9,代码来源:deliciousrec.py

示例13: initializeUserDict

def initializeUserDict(tag,count=2):
  user_dict={}
  # get the top count' popular posts
  for p1 in get_popular(tag=tag)[0:count]:
    # find all users who posted this
    for p2 in get_urlposts(p1['href']):
      user=p2['user']
      user_dict[user]={}
  return user_dict
开发者ID:fkenji,项目名称:ml-tests,代码行数:9,代码来源:deliciousrec.py

示例14: initializeUserDict

def initializeUserDict(tag, count=5):
	user_dict={}
	# отримати рахунок найпопулярніших лінків
	for p1 in get_popular(tag=tag)[0:count]:
		# знайти всіх користувачів, які зберегли цей лінк
		for p2 in get_urlposts(p1['href']):
			user=p2['user']
			user_dict[user]={}
		return user_dict
开发者ID:lluidesia,项目名称:programming-collective-intelligence,代码行数:9,代码来源:deliciousrec.py

示例15: initializeUserDict

def initializeUserDict(tag, count = 5):
    user_dict = {}
    # read in top "count" popular posts
    for p1 in get_popular(tag = tag)[0:count]:
        #find all users who posted this
        for p2 in get_urlposts(p1['url']):
            user = p2['user']
            user_dict[user] = {}
    return user_dict
开发者ID:tsaxena,项目名称:DataMining,代码行数:9,代码来源:deliciousrec.py


注:本文中的pydelicious.get_popular函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。