示例#1
0
文件: NLPDatabase.cs 项目: fsmb/bace
        public static List <BoardOrder> GetBoardOrdersText(string connString)
        {
            var boardOrders = new List <BoardOrder>();

            var query = $@"SELECT FilePath, FileText, FROM [dbo].[BoardOrders]";

            using (var conn = new SqlConnection(connString))
            {
                var command = new SqlCommand(query, conn);
                conn.Open();
                using (var reader = command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            var order = new BoardOrder()
                            {
                                Path = reader.GetString(reader.GetOrdinal("FilePath")),
                                Text = reader.GetString(reader.GetOrdinal("FileText")),
                            };
                            boardOrders.Add(order);
                        }
                    }
                }
                conn.Close();
            }

            return(boardOrders);
        }
示例#2
0
文件: NLPDatabase.cs 项目: fsmb/bace
        public static List <BoardOrder> GetResponses(string connString)
        {
            var orderResponses = new List <BoardOrder>();

            using (var conn = new SqlConnection(connString))
            {
                var query = $@"SELECT Response, FilePath FROM [dbo].[Google]";

                var command = new SqlCommand(query, conn);

                conn.Open();
                using (var reader = command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            var order = new BoardOrder(reader.GetString(reader.GetOrdinal("Response")))
                            {
                                Path = reader.GetString(reader.GetOrdinal("FilePath")),
                            };

                            orderResponses.Add(order);
                        }
                    }
                }
                conn.Close();
            }

            return(orderResponses);
        }
示例#3
0
文件: NLPDatabase.cs 项目: fsmb/bace
        public static List <BoardOrder> GetBoardOrders(string path = "")
        {
            var boardOrders = new List <BoardOrder>();

            var files = Directory.EnumerateFiles(path);

            foreach (var file in files)
            {
                var order = new BoardOrder()
                {
                    Path = file,
                    Text = File.ReadAllText(file),
                };
                boardOrders.Add(order);
            }

            return(boardOrders);
        }