#include <bits/stdc++.h>
using namespace std;
using LL = long long;
void solve();
int main() {
int T = 1; cin >> T;
getchar();
while(T -- ) solve();
return 0;
}
void solve() {
string s; getline(cin, s);
int n = s.size(); string res;
cout << s << "\nAI:";
int i = 0; while(i < n && s[i] == ' ') i ++;
for(; i < n; i ++ ) {
if(s[i] == ' ' && i + 1 < n && isalnum(s[i + 1])) res += s[i];
if(s[i] != ' ') {
if(!isalnum(s[i])) res += ' ';
assert(i < n);
res += s[i];
}
}
s = res;
n = s.size();
for(char &c: s) if(isalpha(c) && c != 'I') c = tolower(c); else if(c == '?') c = '!';
vector<string> str;
res.clear();
for(i = 0; i < n; i ++ ) {
if(i == n - 1 || s[i] == ' ') {
if(s[i] != ' ') res.push_back(s[i]);
if(!res.empty()) str.push_back(res);
res.clear();
if(i == n - 1) break;
} else {
res.push_back(s[i]);
}
}
int m = str.size();
if (str.empty() || !isalnum(str[0][0])) cout << " ";
for(i = 0; i < m; i ++ ) {
if(!isalnum(str[i][0])) {
assert(i < m);
cout << str[i];
} else if (str[i] == "can" && i + 1 < m && str[i + 1] == "you") {
cout << " I can"; i ++;
} else if (str[i] == "could" && i + 1 < m && str[i + 1] == "you") {
cout << " I could"; i ++;
} else if(str[i] == "I" || str[i] == "me") {
cout << " you";
} else {
assert(i < m);
cout << " " << str[i];
}
}
cout << "\n";
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 25岁的心里话
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现