【Hacker News搬运】应用数学规划
-
Title: Applied Mathematical Programming
应用数学规划
Text:
Url: https://web.mit.edu/15.053/www/AMP.htm
很抱歉,作为一个AI,我无法直接访问外部链接或获取链接中的内容。不过,我可以指导你如何使用JinaReader来抓取和分析网页内容,以及如何处理非中文内容。 首先,你需要确保你已经安装了JinaReader和必要的库。以下是一个简单的例子,说明如何使用JinaReader来抓取网页内容,并对非中文内容进行翻译: 1. 安装JinaReader和其他依赖库(如果尚未安装): ```bash pip install jina pip install beautifulsoup4 pip install requests pip install langdetect pip install googletrans==4.0.0-rc1 # 用于翻译的库
- 使用以下Python代码来抓取内容并进行处理:
import jina from bs4 import BeautifulSoup from langdetect import detect from googletrans import Translator # 创建Jina的文档处理器 class WebPageProcessor(jina.Processor): def __init__(self, translator=None): super().__init__() self.translator = translator or Translator() async def handle(self, request, *args, **kwargs): # 从请求中获取URL url = request.input # 使用requests获取网页内容 response = requests.get(url) response.raise_for_status() html_content = response.text # 使用BeautifulSoup解析HTML soup = BeautifulSoup(html_content, 'html.parser') # 找到所有的段落 paragraphs = soup.find_all('p') for p in paragraphs: # 检测文本的语言 text = p.get_text() if detect(text) != 'zh': # 如果文本不是中文,则翻译 translated_text = self.translator.translate(text, dest='zh-cn').text print(translated_text) else: print(text) # 创建Jina的客户端 client = jina.Client() # 添加我们的处理器 client.add_processor(WebPageProcessor()) # 提交任务 response = client.post('/process', inputs=['https://web.mit.edu/15.053/www/AMP.htm']) # 打印结果 print(response)
这段代码会抓取指定的网页内容,然后使用BeautifulSoup解析HTML以找到所有的段落。对于每个段落,它使用
langdetect
库检测语言,如果不是中文,则使用googletrans
库将其翻译成中文。请注意,这段代码只是一个基本的示例,实际使用时可能需要根据具体情况进行调整。例如,你可能需要处理JavaScript渲染的内容,或者根据网页结构调整解析逻辑。此外,频繁使用翻译服务可能会受到API限制或产生费用。
## Post by: ibobev ### Comments: **npalli**: This is from 1977. I suppose it's ok for fundamentals but you can probably do better going with a modern text like<p><pre><code> Model Building in Mathematical Programming by H. Paul Williams (5th Edition)</code></pre> > **npalli**: 这是1977年的。我想这是;基础知识没问题,但你可能会更好地使用现代文本,比如H.Paul Williams的《数学规划中的模型构建》(第5版)</code></pre> **txnf**: convex optimization by boyd vandenberghe should be mentioned <a href="https://web.stanford.edu/~boyd/cvxbook/" rel="nofollow">https://web.stanford.edu/~boyd/cvxbook/</a> > **txnf**: 应该提到boyd vandenberghe的凸优化<a href=“https:”webstanford.edu“~boyd”cvxbook“rel=”nofollow“>https:”/;web.stanford.edu~博伊德;cvxbook</一 **graycat**: "Applied ..."?<p>On the Optimization Ph.D. qualifying exam, got a "High Pass" and the best score in the class.<p>In optimization answered a question in the Kuhn-Tucker constraint qualifications and had the paper accepted quickly in <i>Mathematical Programming</i>.<p>Taught linear programming in a well-known business school for 5 years.<p>NYC had a few users, in a loose group, of linear programming but were not very good at it. Somehow I stumbled into the group and was by far the best, but there was no chance of a career or job there.<p>Net, saw next to nothing in "applied". Believing "applied" would have been homeless living on the street, exactly, no exaggeration.<p>Was not able to help my wife -- she died. Had two cats. They got sick, needed medical care I couldn't afford, and died.<p>Thousands of resume copies posted -- no meaningful responses.<p>The Sheriff showed up with several workers with guns, dumped all my clothes, furniture, music materials, e.g., piano, large professional library on the front -- I had to drive off with a few items.<p>At FedEx I saw a good application, got a memo from the Founder, COB, CEO to pursue it, pleased two crucial members of the BOD, saved FedEx twice, but one manager tried to fire me, another said there was "no money in the budget" for me, the stock promised in 3 weeks was WAY late, and I'd been commuting between Memphis and Maryland.<p>Could have done better with a lawn mowing company, LITERALLY.<p>Actually, big picture: Heavily long, likely still, the main US customer, apparently 99+%, for optimization of any kind was US national security.<p>I was manipulated, fooled, and very seriously hurt by the claim "applied".<p>A fact of life: Nearly always people with money, power, and optimization problems don't understand optimization, fear and resent those who do, and choose just to avoid the subject.<p>So, no wife, no cats, starting a business, no boss, sole-solo founder, do have some original applied math deep in the technology, and face just US Internet startup reality.<p>Optimization? Get a 2 hour overview and otherwise f'get about it. > **graycat**: &“;已应用&“<p> 在优化博士资格考试中,获得了";高通";班上最好的成绩<p> 在优化中回答了Kuhn-Tucker约束条件中的一个问题,并使该论文在<i>数学规划</i>中迅速被接受<p> 在一所知名商学院教授线性规划5年<p> NYC在一个松散的群体中有一些线性规划的用户,但并不擅长。不知怎么的,我偶然进入了这个群体,是迄今为止最好的,但在那里没有职业或工作的机会<p> Net,在";中几乎什么也看不见;适用";。相信";适用";毫不夸张地说,他们本来会无家可归,流落街头<p> 我无法帮助我的妻子,她死了。有两只猫。他们生病了,需要我无法提供的医疗护理;买不起,死了<p> 张贴了数千份简历,但没有任何有意义的回复<p> 警长带着几个拿着枪的工人出现了,把我所有的衣服、家具、音乐材料,比如钢琴、前面的大型专业图书馆都扔掉了——我不得不带着一些东西开车离开<p> 在联邦快递,我看到了一份很好的申请,收到了创始人、COB、首席执行官的备忘录,让我继续努力,让董事会的两位关键成员感到高兴,两次救了联邦快递,但一位经理试图解雇我,另一位说有";预算中没有钱";对我来说,3周后承诺的股票已经晚了很多,我;我一直在孟菲斯和马里兰州之间通勤<p> 如果有一家草坪修剪公司LITERALLY,情况会更好<p> 实际上,总体而言:很长一段时间,很可能仍然是,美国的主要客户,显然99%以上,用于任何形式的优化,都是美国国民安全<p> 我被这种说法操纵、愚弄,并受到了非常严重的伤害";适用"<p> 生活的一个事实:几乎总是有金钱、权力和优化问题的人不会;不了解优化,害怕和憎恨那些这样做的人,选择只是为了避开这个话题<p> 所以,没有妻子,没有猫,创业,没有老板,唯一的独立创始人,在技术中确实有一些原创的应用数学,并面对美国互联网创业的现实<p> 优化?获取2小时的概述,否则将无法获取;开始吧。 **6gvONxR4sf7o**: Has this been updated since 1977? Because the field and tools and even the view points have changed a ton. > **6gvONxR4sf7o**: 这是自1977年以来更新的吗?因为场地和工具,甚至观点都发生了很大的变化。 **Abismith**: [dead] > **Abismith**: [死了]