📣 黑五价提前开抢|VIP一年通行证5折,蓝莓、Offer多多同步特惠
跳转到指定楼层
上一主题 下一主题
收起左侧

[Udacity CS 101]Building a Search Engine (Week #2,3,4) 讨论和加分贴

🔗
 楼主| 加州刺史白十五 2012-5-10 00:32:32 | 只看该作者
全局:
回复 20# 小K


    惭愧啊。。。最近在弄机票和签证,这个公开课都给耽误了
回复

使用道具 举报

🔗
modifiedname 2012-5-10 00:55:43 | 只看该作者
全局:
没事儿的,我看跟的人也不多
关键是内容已经很清楚了,感觉没有什么讨论的必要。。。有心学习的筒子来报道加学分就好拉
回复

使用道具 举报

🔗
modifiedname 2012-5-12 02:13:54 | 只看该作者
全局:
final starred question最后一题求讨论,我觉得解法错了
题目是这样:

#Multi-word Queries

#Triple Gold Star

#For this question, your goal is to modify the search engine to be able to
#handle multi-word queries.  To do this, we need to make two main changes:

#    1. Modify the index to keep track of not only the URL, but the position
#    within that page where a word appears.

#    2. Make a version of the lookup procedure that takes a list of target
#    words, and only counts a URL as a match if it contains all of the target
#    words, adjacent to each other, in the order they are given in the input.

#For example, if the search input is "Monty Python", it should match a page that
#contains, "Monty Python is funny!", but should not match a page containing
#"Monty likes the Python programming language."  The words must appear in the
#same order, and the next word must start right after the end of the previous
#word.

#Modify the search engine code to support multi-word queries. Your modified code
#should define these two procedures:

#    crawl_web(seed) => index, graph
#        A modified version of crawl_web that produces an index that includes
#        positional information.  It is up to you to figure out how to represent
#        positions in your index and you can do this any way you want.  Whatever
#        index you produce is the one we will pass into your multi_lookup(index,
#        keyword) procedure.

#    multi_lookup(index, list of keywords) => list of URLs
#        A URL should be included in the output list, only if it contains all of
#        the keywords in the input list, next to each other.
回复

使用道具 举报

🔗
modifiedname 2012-5-12 02:17:47 | 只看该作者
全局:
程序就不提供了,网站有。

答案假设一个keyword在一个url对应的page content里面只出现一次,于是只记录了一个位置,然后直接就去比这些位置出现的地方是否能连起来。

但是显然这个不可能对吧,显然“位置”应该是个list不会只是一个数而已啊。

等于index结果是
index = {keyword: { url:[pos1, pos2, ....],
                                  url:[pos1, pos2, ....],
                                  .....
                                  url:[pos1, pos2, ....]}
               keyword: { url:[pos1, pos2, ....],
                                  url:[pos1, pos2, ....],
                                   .......
                                  url:[pos1, pos2, ....]}
               ,,,,,,,,,,}

那除了重新用整个的词扫一次网页内容之外,有没有什么简单办法能快速判断多次重复出现的词是在一个连续序列里面呢?
回复

使用道具 举报

🔗
tedwl 2012-5-12 13:20:40 | 只看该作者
全局:
昨天把Unit1搞定了,今天开始看2,嘿嘿。
回复

使用道具 举报

🔗
repentstart 2012-5-13 10:15:41 | 只看该作者
全局:
请问,怎么submit,?
回复

使用道具 举报

🔗
 楼主| 加州刺史白十五 2012-5-13 10:18:28 | 只看该作者
全局:
回复 26# repentstart


    你用的tudou看的?要submit只能去官网那个视频看
回复

使用道具 举报

🔗
zlxwd 2012-5-14 15:59:56 | 只看该作者
全局:
hw3-8

  1. def check_sudoku(input):
  2.     n = len(input)
  3.     for i in range(0, n):
  4.         checker = set([])
  5.         for j in range(0, n):
  6.             if input[i][j] < 1 or input[i][j] > n or str(input[i][j]).find('.') != -1:
  7.                 return False
  8.             if input[i][j] in checker:
  9.                 return False
  10.             else:
  11.                 checker.add(input[i][j])
  12.                
  13.     for i in range(0, n):
  14.         checker = set([])
  15.         for j in range(0, n):
  16.             if input[j][i] in checker:
  17.                 return False
  18.             else:
  19.                 checker.add(input[j][i])
  20.                
  21.     return True

复制代码
回复

使用道具 举报

🔗
zlxwd 2012-5-14 16:12:43 | 只看该作者
全局:
hw4-6

  1. def record_user_click(index,keyword,url):
  2.     urls = lookup(index, keyword)
  3.     if urls:
  4.         for entry in urls:
  5.             if entry[0] == url:
  6.                 entry[1] = entry[1] + 1

复制代码
回复

使用道具 举报

🔗
zlxwd 2012-5-14 16:18:27 | 只看该作者
全局:
回复 23# 小K

final starred question?
我只看到homework6有个starred question
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表