贫瘠之地

华北无浪漫,死海扬起帆
多少个夜晚,独自望着天

0%

This traditional homemade mulled wine recipe is incredibly easy to make and always SO cozy and delicious.

这种传统的自制热葡萄酒配方非常容易制作,而且非常舒适美味

圣诞节来喝热红酒吧~

Mulled Wine 热葡萄酒

也被称为 glühwein、vino-caliente、glögg、vin brulé、bisschopswijn、vin chaud、candola、vinho quente… 或者其他上百个名字,这取决于你在世界上的位置

阅读全文 »

背景

看了新一期的阮一峰周刊,引用了一篇博客 Information Extraction with Large Language Models - Parsing Unstructured Data with GPT-3

Information Extraction with Large Language Models - Parsing Unstructured Data with GPT-3 (marcotm.com)

In the past months, ChatGPT has been dominating the news headlines, and people are both excited and scared by its quite sophisticated ability to generate texts. Besides short- and long-form text generation, there are quite a few other use cases which provide a lot of practical value. With the current generation of these large language models (LLMs), many of the classic tasks in Natural Language Processing (NLP) such as text classification, sentiment analysis, or named entity recognition, are almost trivial to solve.

在过去的几个月里,ChatGPT 一直占据着新闻头条,人们对它相当复杂的文本生成能力既兴奋又害怕,除了生成短格式和长格式文本外,还有许多其他用例提供了很大的实用价值

随着这些大型语言模型(LLM)的出现,自然语言处理(NLP)中的许多经典任务,如文本分类、情感分析或命名实体识别,几乎都很难解决

In this article, I have documented some experimentation with how to use GPT-3 (update: and 3.5) to extract structured information from unstructured texts and I hope the article can serve as a tutorial for how to approach such a task with an LLM.

在这篇文章中,我记录了一些关于如何使用 GPT-3(更新:和 3.5)从非结构化文本中提取结构化信息的实验,我希望这篇文章可以作为如何使用 LLM 处理此类任务的教程

作者维护了一个招聘网站,但是招聘信息是以非结构化文本形式进行投递,作者希望将其重要信息提取出来,维护数据后用户可以通过相关性进行查询

阅读全文 »

前言

在看阿里开源的 TransmittableThreadLocal Agent 时发现了在对类进行增强的流程中使用了 WeakHashMap

com.alibaba.ttl3.agent.TtlExtensionTransformletManager

1
2
3
4
5
6
7
8
9
10
// NOTE: use WeakHashMap as a Set collection, value is always null.
private final WeakHashMap<ClassLoader, ?> collectedClassLoaderHistory = new WeakHashMap<>(512);

// Map: ExtensionTransformlet ClassLoader -> ExtensionTransformlet ClassName -> ExtensionTransformlet instance(not include from parent classloader)
private final WeakHashMap<ClassLoader, Map<String, TtlTransformlet>> classLoader2ExtensionTransformlets =
new WeakHashMap<>(512);

// Map: ExtensionTransformlet ClassLoader -> ExtensionTransformlet ClassName -> ExtensionTransformlet instance(include from parent classloader)
private final WeakHashMap<ClassLoader, Map<String, TtlTransformlet>> classLoader2ExtensionTransformletsIncludeParentCL =
new WeakHashMap<>(512);

这里使用了弱引用元素的 HashMap,应该是只用于 JVM 启动的类加载阶段,所以使用了特殊的引用类型

阅读全文 »

#5

#5 Bourbon Cocktail Recipe | PUNCH (punchdrink.com)

作为 2015 年 1 月发布 Trick Dog 的唐人街菜单的爆款,这款“辛辣波本柑橘香肠”(正如店主 Josh Harris 所描述的)正处于潮流之中,在菜单发布的 6 个月里,这家酒吧的销量超过了 11000 个 #5

这种饮料通常用一串添加了香菜风味的芒果块装饰,但也可以使用风干橙片和姜糖来获得类似的泥土味和酸味

阅读全文 »

列表解析器

返回逗号分隔的项目列表时,可以使用此输出解析器

解析器和 prompt

1
2
3
4
5
6
7
8
9
10
11
# 列表解析器
output_parser = CommaSeparatedListOutputParser()

# 列表解析器自带格式说明
format_instructions = output_parser.get_format_instructions()
# prompt template
prompt_template = PromptTemplate(
template="列举出五个{subject}.\n{format_instructions}",
input_variables=["subject"],
partial_variables={"format_instructions": format_instructions}
)

使用

阅读全文 »