Lingara Lingara 文档 学习指南 API 库 应用 构建 网页版
语言: 中文简体

导师备注

本页译自英文。如两者有出入,以英文页面为准。 阅读英文页面

你的应用可以在回复中加入 tutor_note,向 Lingara 的导师提供一行上下文,例如学习者刚刚练习了哪些词。只有当你的清单声明了它,并且学习者在安装你的应用时开启了它,备注才会到达导师。要更改这一选择,学习者需要卸载你的应用后重新安装。

Lingara 如何处理它

  • 换行会变成空格。
  • 控制字符和方向覆盖字符会被移除。
  • 超过 280 个字符的备注会被截短到 280 个字符,并以 … 结尾。字符按 Unicode 标量值计数,而不是按字节或屏幕上的字形计数。
  • 你的清单未声明、或学习者未允许的备注会被丢弃。

导师如何读取它

导师会把你的备注当作来自第三方的引用文本来读,绝不会当作指令。被 Lingara 安全检查拒绝的备注会被丢弃,学习者的这一轮对话会在没有它的情况下继续。学习者永远看不到这条备注。

好的备注

好的备注是导师可以使用的一条简单事实,例如“学习者刚刚复习了日语计划中的 5 个词。”它说明学习者在做什么,而不是导师应该做什么。不要写入指令、对学习者的评判,以及学习者在你的卡片上没有看到的任何内容。

代码示例语言

TypeScript

function withNote(request: AppRenderRequest) {
  const note = planLine(request);
  // Plain text, at most 280 characters; the tutor reads it, the learner does not.
  return note === "" ? todayCard(0) : reply(todayCard(0)).tutorNote(note);
}

Rust

async fn render(seen: Seen, request: AppRenderRequest) -> Result<Reply, BoxError> {
    let (lang, progress) = shared_plan(&request);
    let count = seen.lock().map_err(|_| "poisoned")?.get(&request.subject).copied().unwrap_or(0);
    let card = today_card("Today's five", &lang)?;
    // Plain text the learner's tutor can read: at most 280 characters.
    let note = match progress {
        Some((done, total)) => format!("The learner has reviewed {count} words with this app today; {done} of {total} sets done."),
        None => format!("The learner has reviewed {count} words with this app today."),
    };
    Ok(reply(card).tutor_note(note)?)
}

Go

card, err := lingaraapps.NewCard().Heading("Daily five", 1).Text("雨 · 雪 · 风 · 云 · 雷").Build()
if err != nil {
	return nil, err
}
// Plain text, at most 280 characters, for Lingara's tutor to use.
return lingaraapps.Reply(card).
	TutorNote("The learner is reviewing weather words today."), nil

Java

import com.getlingara.apps.Card;
import com.getlingara.apps.Reply;

Card card = Card.card().heading("Today's five", 1).term("雨", "yǔ", "rain", "zh").build();
// Plain text, at most 280 characters; the tutor reads it beside the card.
return Reply.reply(card).tutorNote("The learner is reviewing weather words today.");

Kotlin

import com.getlingara.apps.kotlin.Reply
import com.getlingara.apps.kotlin.card
import com.getlingara.apps.kotlin.reply

val c =
    card {
        heading("Today's five", 1)
        term("雨", reading = "yǔ", gloss = "rain", lang = "zh")
    }
// Plain text, at most 280 characters; the tutor reads it beside the card.
return reply(c).tutorNote("The learner is reviewing weather words today.")

Ruby

note = plan_line(request)
# Plain text, at most 280 characters; the tutor reads it, the learner does not.
note.empty? ? today_card(0) : Lingara::Apps.reply(today_card(0)).tutor_note(note)

PHP

use Lingara\Apps\Reply;

function withNote(AppRenderRequest $request): CardModel|Reply
{
    $note = planLine($request);
    // Plain text, at most 280 characters; the tutor reads it, the learner does not.
    return $note === '' ? todayCard(0) : Reply::of(todayCard(0))->tutorNote($note);
}