vumichien commited on
Commit
44a025a
·
1 Parent(s): d8fc7e8

Add application file

Browse files
Dockerfile ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Copy requirements first for better caching
6
+ COPY requirements.txt .
7
+
8
+ # Install dependencies
9
+ RUN pip install --no-cache-dir -r requirements.txt
10
+
11
+ # Copy the rest of the application
12
+ COPY . .
13
+
14
+ # Create data directory
15
+ RUN mkdir -p data
16
+
17
+ # Expose the port that the app will run on
18
+ EXPOSE 7860
19
+
20
+ # Set environment variables for Hugging Face Spaces
21
+ ENV PYTHONUNBUFFERED=1
22
+ ENV HOST=0.0.0.0
23
+ ENV PORT=7860
24
+
25
+ # Command to run the application
26
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
app/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # This file makes the app directory a Python package
app/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (166 Bytes). View file
 
app/routes/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # This file makes the routes directory a Python package
app/routes/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (173 Bytes). View file
 
app/routes/__pycache__/embedding_routes.cpython-311.pyc ADDED
Binary file (2.76 kB). View file
 
app/routes/__pycache__/prediction_routes.cpython-311.pyc ADDED
Binary file (2.35 kB). View file
 
app/routes/embedding_routes.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import shutil
3
+ from fastapi import APIRouter, UploadFile, File, HTTPException
4
+ from typing import Dict, Any
5
+
6
+ from app.services.embedding_service import process_and_create_embeddings
7
+
8
+ router = APIRouter()
9
+
10
+
11
+ @router.post("/create-embeddings")
12
+ async def create_embeddings(file: UploadFile = File(...)):
13
+ """
14
+ Create embeddings from an uploaded Excel or CSV file.
15
+
16
+ - **file**: The Excel or CSV file containing questions and answers
17
+
18
+ Returns a success message if embeddings are created successfully.
19
+ """
20
+ # Get file extension
21
+ file_extension = os.path.splitext(file.filename)[1].lower()
22
+
23
+ # Determine file type based on extension
24
+ if file_extension == ".xlsx" or file_extension == ".xls":
25
+ file_type = "excel"
26
+ elif file_extension == ".csv":
27
+ file_type = "csv"
28
+ else:
29
+ raise HTTPException(
30
+ status_code=400,
31
+ detail="Unsupported file type. Please upload an Excel (.xlsx, .xls) or CSV (.csv) file.",
32
+ )
33
+
34
+ # Create a temporary file to store the uploaded file
35
+ temp_file_path = f"temp_{file.filename}"
36
+ try:
37
+ # Save the uploaded file
38
+ with open(temp_file_path, "wb") as buffer:
39
+ shutil.copyfileobj(file.file, buffer)
40
+
41
+ # Process the file and create embeddings
42
+ result = process_and_create_embeddings(temp_file_path, file_type)
43
+
44
+ if result["status"] == "error":
45
+ raise HTTPException(status_code=400, detail=result["message"])
46
+
47
+ return result
48
+ except Exception as e:
49
+ raise HTTPException(status_code=500, detail=str(e))
50
+ finally:
51
+ # Clean up the temporary file
52
+ if os.path.exists(temp_file_path):
53
+ os.remove(temp_file_path)
app/routes/prediction_routes.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import APIRouter, HTTPException, Query
2
+ from pydantic import BaseModel
3
+ from typing import Optional
4
+
5
+ from app.services.prediction_service import predict_answer
6
+
7
+ router = APIRouter()
8
+
9
+
10
+ class PredictionRequest(BaseModel):
11
+ user_input: str
12
+
13
+
14
+ class PredictionResponse(BaseModel):
15
+ status: str
16
+ answer: Optional[str] = None
17
+ score: Optional[str] = None
18
+ message: Optional[str] = None
19
+
20
+
21
+ @router.post("/predict", response_model=PredictionResponse)
22
+ async def get_prediction(
23
+ request: PredictionRequest,
24
+ threshold_q: float = Query(0.7, description="Threshold for question matching"),
25
+ threshold_a: float = Query(0.65, description="Threshold for answer matching"),
26
+ ):
27
+ """
28
+ Predict an answer based on user input.
29
+
30
+ - **user_input**: The user's question or input text
31
+ - **threshold_q**: Threshold for question matching (default: 0.7)
32
+ - **threshold_a**: Threshold for answer matching (default: 0.65)
33
+
34
+ Returns the predicted answer and match type.
35
+ """
36
+ result = predict_answer(request.user_input, threshold_q, threshold_a)
37
+
38
+ if result["status"] == "error":
39
+ raise HTTPException(status_code=500, detail=result["message"])
40
+
41
+ return result
app/services/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # This file makes the services directory a Python package
app/services/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (175 Bytes). View file
 
app/services/__pycache__/embedding_service.cpython-311.pyc ADDED
Binary file (5.53 kB). View file
 
app/services/__pycache__/model_service.cpython-311.pyc ADDED
Binary file (3.77 kB). View file
 
app/services/__pycache__/prediction_service.cpython-311.pyc ADDED
Binary file (3.32 kB). View file
 
app/services/embedding_service.py ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import json
3
+ import re
4
+ import numpy as np
5
+ import os
6
+ from typing import List, Dict, Tuple, Any
7
+
8
+ from app.services.model_service import get_model, reload_embeddings
9
+
10
+ # Ensure data directory exists
11
+ os.makedirs("data", exist_ok=True)
12
+
13
+
14
+ def remove_prefix(text: str, prefix_pattern: str) -> str:
15
+ """
16
+ Removes the prefix matching the given pattern from the text.
17
+ """
18
+ return re.sub(prefix_pattern, "", text).strip()
19
+
20
+
21
+ def process_file(file_path: str, file_type: str) -> List[Dict[str, str]]:
22
+ """
23
+ Process Excel or CSV file and extract question-answer pairs.
24
+ """
25
+ if file_type == "excel":
26
+ df = pd.read_excel(file_path)
27
+ elif file_type == "csv":
28
+ df = pd.read_csv(file_path)
29
+ else:
30
+ raise ValueError("Unsupported file type. Use 'excel' or 'csv'.")
31
+
32
+ # Check if the necessary columns exist
33
+ if "質問" not in df.columns or "回答" not in df.columns:
34
+ raise ValueError("The file must contain '質問' and '回答' columns.")
35
+
36
+ # Initialize the list to store processed data
37
+ qa_list = []
38
+ df.dropna(inplace=True)
39
+ # Iterate over each row in the DataFrame
40
+ for index, row in df.iterrows():
41
+ raw_question = str(row["質問"])
42
+ raw_answer = str(row["回答"])
43
+
44
+ # Remove prefixes using regex patterns
45
+ question = remove_prefix(raw_question, r"^Q\d+\.\s*")
46
+ answer = remove_prefix(raw_answer, r"^A\.\s*")
47
+
48
+ qa_list.append({"question": question, "answer": answer})
49
+ # print(qa_list)
50
+
51
+ return qa_list
52
+
53
+
54
+ def save_raw_data(qa_list: List[Dict[str, str]]) -> None:
55
+ """
56
+ Save the raw question-answer pairs to a JSON file.
57
+ """
58
+ with open("data/raw.json", "w", encoding="utf-8") as json_file:
59
+ json.dump(qa_list, json_file, ensure_ascii=False, indent=2)
60
+
61
+
62
+ def create_and_save_embeddings(qa_list: List[Dict[str, str]]) -> None:
63
+ """
64
+ Create embeddings for questions and answers and save them.
65
+ """
66
+ questions = [item["question"] for item in qa_list]
67
+ answers = [item["answer"] for item in qa_list]
68
+
69
+ # Use the global model
70
+ model = get_model()
71
+
72
+ # Create embeddings for questions and answers
73
+ question_embeddings = model.encode(questions, convert_to_numpy=True)
74
+ answer_embeddings = model.encode(answers, convert_to_numpy=True)
75
+
76
+ # Save embeddings as numpy arrays
77
+ np.save("data/question_embeddings.npy", question_embeddings)
78
+ np.save("data/answer_embeddings.npy", answer_embeddings)
79
+
80
+ # Save the original data
81
+ with open("data/qa_data.json", "w", encoding="utf-8") as f:
82
+ json.dump(qa_list, f, ensure_ascii=False, indent=2)
83
+
84
+
85
+ def process_and_create_embeddings(file_path: str, file_type: str) -> Dict[str, Any]:
86
+ """
87
+ Process the input file and create embeddings.
88
+ """
89
+ try:
90
+ qa_list = process_file(file_path, file_type)
91
+ save_raw_data(qa_list)
92
+ create_and_save_embeddings(qa_list)
93
+
94
+ # Reload embeddings into memory
95
+ reload_embeddings()
96
+
97
+ return {
98
+ "status": "success",
99
+ "message": "Embeddings created successfully",
100
+ "data": {"total_qa_pairs": len(qa_list)},
101
+ }
102
+ except Exception as e:
103
+ return {"status": "error", "message": str(e)}
app/services/model_service.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import numpy as np
3
+ from sentence_transformers import SentenceTransformer
4
+ from typing import List, Dict, Tuple, Any, Optional
5
+
6
+ # Global variables to store model and data
7
+ _model = None
8
+ _question_embeddings = None
9
+ _answer_embeddings = None
10
+ _qa_data = None
11
+
12
+
13
+ def initialize_model() -> None:
14
+ """
15
+ Initialize the model once and store it in a global variable.
16
+ """
17
+ global _model
18
+ if _model is None:
19
+ _model = SentenceTransformer("pkshatech/GLuCoSE-base-ja")
20
+ return _model
21
+
22
+
23
+ def get_model() -> SentenceTransformer:
24
+ """
25
+ Get the loaded model or initialize it if not loaded.
26
+ """
27
+ global _model
28
+ if _model is None:
29
+ _model = initialize_model()
30
+ return _model
31
+
32
+
33
+ def load_embeddings() -> Tuple[np.ndarray, np.ndarray, List[Dict[str, str]]]:
34
+ """
35
+ Load embeddings and QA data from files.
36
+ """
37
+ global _question_embeddings, _answer_embeddings, _qa_data
38
+
39
+ try:
40
+ _question_embeddings = np.load("data/question_embeddings.npy")
41
+ _answer_embeddings = np.load("data/answer_embeddings.npy")
42
+
43
+ with open("data/qa_data.json", "r", encoding="utf-8") as f:
44
+ _qa_data = json.load(f)
45
+
46
+ return _question_embeddings, _answer_embeddings, _qa_data
47
+ except FileNotFoundError as e:
48
+ print(f"Warning: Embeddings not found. {str(e)}")
49
+ return None, None, None
50
+ except Exception as e:
51
+ print(f"Error loading embeddings: {str(e)}")
52
+ return None, None, None
53
+
54
+
55
+ def get_embeddings() -> (
56
+ Tuple[Optional[np.ndarray], Optional[np.ndarray], Optional[List[Dict[str, str]]]]
57
+ ):
58
+ """
59
+ Get the loaded embeddings or load them if not loaded.
60
+ """
61
+ global _question_embeddings, _answer_embeddings, _qa_data
62
+
63
+ if _question_embeddings is None or _answer_embeddings is None or _qa_data is None:
64
+ _question_embeddings, _answer_embeddings, _qa_data = load_embeddings()
65
+
66
+ return _question_embeddings, _answer_embeddings, _qa_data
67
+
68
+
69
+ def reload_embeddings() -> bool:
70
+ """
71
+ Reload embeddings from files.
72
+ """
73
+ global _question_embeddings, _answer_embeddings, _qa_data
74
+
75
+ try:
76
+ _question_embeddings, _answer_embeddings, _qa_data = load_embeddings()
77
+ print(f"Embeddings reloaded successfully. {len(_qa_data)} QA pairs available.")
78
+ return True
79
+ except Exception as e:
80
+ print(f"Error reloading embeddings: {str(e)}")
81
+ return False
app/services/prediction_service.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import numpy as np
3
+ from sentence_transformers import util
4
+ from typing import Tuple, List, Dict, Any, Optional
5
+
6
+ from app.services.model_service import get_model, get_embeddings
7
+
8
+
9
+ def search_answer(
10
+ user_input: str,
11
+ model,
12
+ question_embeddings: np.ndarray,
13
+ answer_embeddings: np.ndarray,
14
+ threshold_q: float,
15
+ threshold_a: float,
16
+ answers: List[str],
17
+ ) -> Tuple[str, str]:
18
+ """
19
+ Search for an answer using cosine similarity.
20
+ """
21
+ # Encode with batch_size and show_progress_bar=False to speed up
22
+ user_embedding = model.encode(
23
+ [user_input],
24
+ convert_to_numpy=True,
25
+ batch_size=1,
26
+ show_progress_bar=False,
27
+ normalize_embeddings=True, # Pre-normalize to speed up cosine similarity
28
+ )
29
+
30
+ # Calculate cosine similarity with questions
31
+ cos_scores_q = util.cos_sim(user_embedding, question_embeddings)[0]
32
+ best_q_idx = np.argmax(cos_scores_q)
33
+ score_q = cos_scores_q[best_q_idx]
34
+
35
+ if score_q >= threshold_q:
36
+ return (
37
+ answers[best_q_idx].replace("\n", " \n"),
38
+ f"{score_q:.2f}",
39
+ )
40
+
41
+ # Calculate cosine similarity with answers
42
+ cos_scores_a = util.cos_sim(user_embedding, answer_embeddings)[0]
43
+ best_a_idx = np.argmax(cos_scores_a)
44
+ score_a = cos_scores_a[best_a_idx]
45
+
46
+ if score_a >= threshold_a:
47
+ return (
48
+ answers[best_a_idx].replace("\n", " \n"),
49
+ f"{score_a:.2f}",
50
+ )
51
+
52
+ return (
53
+ "申し訳ありませんが、ご質問の答えを見つけることができませんでした。もう少し詳しく説明していただけますか?",
54
+ "一致なし",
55
+ )
56
+
57
+
58
+ def predict_answer(
59
+ user_input: str, threshold_q: float = 0.5, threshold_a: float = 0.5
60
+ ) -> Dict[str, Any]:
61
+ """
62
+ Predict an answer based on user input.
63
+ """
64
+ try:
65
+ # Get the global model and embeddings
66
+ model = get_model()
67
+ question_embeddings, answer_embeddings, qa_data = get_embeddings()
68
+
69
+ if question_embeddings is None or answer_embeddings is None or qa_data is None:
70
+ return {
71
+ "status": "error",
72
+ "message": "Embeddings not found. Please create embeddings first.",
73
+ }
74
+
75
+ answers = [item["answer"] for item in qa_data]
76
+
77
+ answer, score = search_answer(
78
+ user_input,
79
+ model,
80
+ question_embeddings,
81
+ answer_embeddings,
82
+ threshold_q,
83
+ threshold_a,
84
+ answers,
85
+ )
86
+
87
+ return {"status": "success", "answer": answer, "score": score}
88
+ except Exception as e:
89
+ return {"status": "error", "message": str(e)}
data/answer_embeddings.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:925632dc69ab4df0223970df60cc9054dd46e2958e597e6998514bd3b33fc703
3
+ size 67712
data/manabi.csv ADDED
@@ -0,0 +1,1029 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 質問,回答
2
+ Q1.「地域学校協働活動」とは何ですか?,A.地域と学校がパートナーとなり、地域全体で子供たちの成長を支え、地域を創生する活動です。
3
+ Q2.なぜ地域学校協働活動を推進する必要があるのですか?,A.地域における教育力の低下、家庭の孤立化などの課題や、学校を取り巻く問題の複雑化・困難化に対して社会総掛かりで対応することが求められています。そのためには、地域と学校がパートナーとして連携・協働するための組織的・継続的な仕組みが必要不可欠です。また、新学習指導要領が目指す「社会に開かれた教育課程」の実現に向けて、学校は地域との連携・協働を一層進めていくことが重要であり、より多くの住民等が子供たちの成長を支える活動に参画するための基盤整備していくことが求められています。こうした背景を踏まえ、平成29年3月に社会教育法が改正されました。
4
+ Q3.「地域学校協働活動」によりどのような効果があるのですか?,"A.アンケートによれば、子供たち・学校・地域へ様々な効果があったとの回答が得られています。
5
+ ・子供たちへの効果:地域住民と交流することにより、様々な体験や経験の場が増え、「コミュニケーション能力の向上につながった」「地域への理解・関心が深まった」
6
+ ・学校への効果:「教員が授業や生徒指導などにより力を注ぐことができた」
7
+ ・地域への効果:「地域の活性化につながった」「生きがいづくりや自己実現につながった」
8
+ また、東日本大震災時に自治組織の立ち上げが順調だったとの回答も得られました。
9
+ (平成27年度地域学校協働活動の実施状況アンケート調査(文部科学省・国立教育政策研究所))"
10
+ Q4.「地域学校協働本部」とは何ですか?,A.平成27年12月の中央教育審議会答申において、従来「学校支援地域本部」等の活動を基盤として、地域による学校の「支援」から、地域と学校双方向の連携・協働へ、また「個別の活動」から活動の「総合化・ネットワーク」を目指し、幅広い地域住民の参画により、地域学校協働活動を推進する新たな体制として提言されたものです。
11
+ Q5.地域学校協働活動の推進により、教職員の負担が増えるのではないですか?,A.地域学校協働活動のスタートアップの時点では教職員へ負担が大きいという声もあります。しかしながら、学校のみならず住民や保護者も含めた社会総掛かりでの教育の実現を目指すものであり、教職員の負担軽減にも資するものと考えられます。
12
+ Q6.地域学校協働活動についての国はどのような目標を掲げているのですか?,"A.地域学校協働活動について、以下のような目標を掲げています。
13
+ ・2022年度までに、全小中学校区をカバーして地域協働活動を推進
14
+ (働き方改革実行計画(平成29年3月28日 働き方改革実現会議決定))
15
+ ・2022年度までに、全小中学校区をカバーして地域協働本部を設置
16
+ (ニッポン一億総活躍プラン(平成28年6月2日閣議決定))"
17
+ Q7.地域学校協働活動に対する国の財政的な支援はありますか?,A.文部科学省では、地域学校協働活動の全国的な推進のため平成29年度より「地域学校協働活動推進事業」(令和2年度からは「地域と学校の連携・協働体制構築事業」に名称変更)を実施しています。本事業は、自治体における地域学校協働活動の実施に関し、国庫負担1/3の割合で補助することを目的としており、地域と学校をつなぐコーディネーターとしての役割を果たす地域学校協働活動推進員や、活動を行うボランティア等への謝金、自治体が実施する研修会等に係る経費を計上しています。
18
+ Q8.「地域学校協働活動」と「学校運営協議会」との関係は?学校運営協議会だけで十分では?,A.学校運営協議会は協議の場です。学校運営協議会において、学校運営への必要な支援について協議が行われ、その結果を踏まえて、より円滑かつ効果的に地域学校協働活動を行うことにより、教育活動の充実や教職員の負担軽減など、学校運営改善に結びつけることが重要です。
19
+ Q1.コミュニティ・スクールとは何ですか?,A.「学校運営協議会制度」又は「学校運営協議会制度を導入した学校」のことです。コミュニティ・スクールは学校と地域住民等が力を合わせて学校の運営に取り組むことが可能と��る「地域とともにある学校づくり」への転換を図るための有効な仕組みです。
20
+ Q2.「学校運営協議会」とは何ですか?,A.学校と地域住民や保護者等が学校運営の基本方針の承認や様々な課題の共有を図るともに、学校運営への必要な支援等について協議する場です。(地方教育行政の組織及び運営に関する法律第47条の5、下記の「関係法令について」を参照)
21
+ Q3.「コミュニティ・スクール」の役割は何ですか?,"A.学校運営協議会の主な役割は以下のとおりです。
22
+ ・校長が作成する学校運営の基本方針を承認する。
23
+ ・学校運営について、教育委員会又は校長に意見を述べることができる。
24
+ ・教職員の任用に関して、教育委員会規則に定める事項について、教育委員会に意見を述べることができる。"
25
+ Q4.コミュニティ・スクールでは、教育委員会や校長に自由に意見を言えるのですか?,"A.教育委員会や校長に意見を述べるときは、個人の意見がそのまま尊重されるのではなく、保護者や地域住民等の代表による""合議体""としての意見を述べることになります。"
26
+ Q5.「地域とともにある学校」には何が必要ですか?,A.学校運営協議会で行う協議に加え、熟議・協働・マネジメントの3つの視点をもって、「情報の共有→課題・目標・ビジョンの共有→アクションの共有→成功体験の共有」の共有の好循環を作ることが重要です。
27
+ Q6.熟議・協働・マネジメントとは何ですか?,"A.
28
+ ・熟議:多くの当事者により「熟慮」と「議論」を重ねながら課題解決を目指す対話のことです。当事者としては、保護者・教職員・地域住民等が含まれます。
29
+ ・協働:同じ目的・目標に向かって、対等の立場で協力して共に働くことです。保護者や地域住民が計画段階から参画し、課題や目標等を共有したうえで、目標に向けた取組を進めます。
30
+ ・マネジメント:校長は、校務をつかさどり、所属職員を監督します。コミュニティ・スクールの運営には校長の強いリーダーシップが必要です。"
31
+ Q1.最近の関連する法律の改正について教えてください。,"A.平成27年12月の中央教育審議会の答申を踏まえ、平成29年3月に社会教育法と地方教育行政の組織及び運営に関する法律第47条の6が改正され、平成29年4月に施行されました。(※令和2年4月1日より、第47条の5)
32
+
33
+ (1)社会教育法
34
+ ・地域学校協働活動を推進する際に、教育委員会が地域と学校との連携協力体制を整備しました。
35
+ ・地域と学校をつなぐ役割を担う地域学校協働活動推進員の委嘱に関する規定を整備しました。
36
+
37
+ (2)地方教育行政の組織及び運営に関する法律第47条の6(※令和2年4月1日より、第47条の5)
38
+ ・各教育委員会に対して学校運営協議会の設置が教育委員会の努力義務化されました。"
39
+ Q1.地域の住民が、学校のためにボランティアとして参加するにはどうしたら良いですか?,A.各地方自治体やNPO法人等にご相談ください。
40
+ Q2.企業やNPO団体が、学校との連携・協働に参加するにはどうしたら良いですか?,A.「土曜学習応援団」へ賛同・登録ください。トップ頁の「企業等による教育プログラム」又は「企業・団体の方」をご覧く
41
+ Q1.土曜学習応援団とは何ですか?,A.子供たちの豊かな学びを支えるために、多様な企業・団体・大学等に「土曜学習応援団」にご賛同(ご参画)・登録いただき、出前授業・施設見学などにより、特色・魅力ある教育活動をしていただいています。提供していただいた教育プログラムはWEB上で検索可能です。学校・教育委員会・コーディネーター・保護者などに教育プログラムを検索していただき、平日の授業や放課後、土日祝祭日等に出前授業等を行っていただくことができます。
42
+ Q2.土曜学習応援団の学習プログラムは土曜日に実施する・されるのですか?,A.土曜日に限定されません。平日の授業中や放課後、土曜日、日曜日、祝日などさまざまです。各教育プログラムに、実施の日を掲載しています。実際の実施日時は、各企業・団体等と、学校等とが相談して決めることができます。
43
+ Q3.どのような学習プログラムが登録されていますか?,A.理科・実験、体育・スポーツ、音楽、美術、社会、プログラミングなどの学校の授業の教科に関連したプログラムや、キャリア教育、環境、金融・経済、安全・防災、国際理解などの教科横断型のプログラムがあります。
44
+ Q4.土曜学習応援団に賛同・登録しているのはどのような企業・団体ですか?,A.一般企業、NPO法人、大学、各種組合、専門学校等、さまざまです。800以上の企業等が登録しています。
45
+ Q5.企業・団体・大学等が、土曜学習応援団に賛同・登録するメリットは何ですか?,A.自社の技術・知識を活かして、社会に貢献できます。経営のトップが、SDGs、ESD、CSRなどを意識するようになり、企業の価値評価にも利用されるようになってきております。出前授業を通じて、社員の自社製品に対する理解やモチベーションアップにも繋がります。
46
+ ,
47
+ ,
48
+ ,
49
+ ,
50
+ ,
51
+ ,
52
+ ,
53
+ ,
54
+ ,
55
+ ,
56
+ ,
57
+ ,
58
+ ,
59
+ ,
60
+ ,
61
+ ,
62
+ ,
63
+ ,
64
+ ,
65
+ ,
66
+ ,
67
+ ,
68
+ ,
69
+ ,
70
+ ,
71
+ ,
72
+ ,
73
+ ,
74
+ ,
75
+ ,
76
+ ,
77
+ ,
78
+ ,
79
+ ,
80
+ ,
81
+ ,
82
+ ,
83
+ ,
84
+ ,
85
+ ,
86
+ ,
87
+ ,
88
+ ,
89
+ ,
90
+ ,
91
+ ,
92
+ ,
93
+ ,
94
+ ,
95
+ ,
96
+ ,
97
+ ,
98
+ ,
99
+ ,
100
+ ,
101
+ ,
102
+ ,
103
+ ,
104
+ ,
105
+ ,
106
+ ,
107
+ ,
108
+ ,
109
+ ,
110
+ ,
111
+ ,
112
+ ,
113
+ ,
114
+ ,
115
+ ,
116
+ ,
117
+ ,
118
+ ,
119
+ ,
120
+ ,
121
+ ,
122
+ ,
123
+ ,
124
+ ,
125
+ ,
126
+ ,
127
+ ,
128
+ ,
129
+ ,
130
+ ,
131
+ ,
132
+ ,
133
+ ,
134
+ ,
135
+ ,
136
+ ,
137
+ ,
138
+ ,
139
+ ,
140
+ ,
141
+ ,
142
+ ,
143
+ ,
144
+ ,
145
+ ,
146
+ ,
147
+ ,
148
+ ,
149
+ ,
150
+ ,
151
+ ,
152
+ ,
153
+ ,
154
+ ,
155
+ ,
156
+ ,
157
+ ,
158
+ ,
159
+ ,
160
+ ,
161
+ ,
162
+ ,
163
+ ,
164
+ ,
165
+ ,
166
+ ,
167
+ ,
168
+ ,
169
+ ,
170
+ ,
171
+ ,
172
+ ,
173
+ ,
174
+ ,
175
+ ,
176
+ ,
177
+ ,
178
+ ,
179
+ ,
180
+ ,
181
+ ,
182
+ ,
183
+ ,
184
+ ,
185
+ ,
186
+ ,
187
+ ,
188
+ ,
189
+ ,
190
+ ,
191
+ ,
192
+ ,
193
+ ,
194
+ ,
195
+ ,
196
+ ,
197
+ ,
198
+ ,
199
+ ,
200
+ ,
201
+ ,
202
+ ,
203
+ ,
204
+ ,
205
+ ,
206
+ ,
207
+ ,
208
+ ,
209
+ ,
210
+ ,
211
+ ,
212
+ ,
213
+ ,
214
+ ,
215
+ ,
216
+ ,
217
+ ,
218
+ ,
219
+ ,
220
+ ,
221
+ ,
222
+ ,
223
+ ,
224
+ ,
225
+ ,
226
+ ,
227
+ ,
228
+ ,
229
+ ,
230
+ ,
231
+ ,
232
+ ,
233
+ ,
234
+ ,
235
+ ,
236
+ ,
237
+ ,
238
+ ,
239
+ ,
240
+ ,
241
+ ,
242
+ ,
243
+ ,
244
+ ,
245
+ ,
246
+ ,
247
+ ,
248
+ ,
249
+ ,
250
+ ,
251
+ ,
252
+ ,
253
+ ,
254
+ ,
255
+ ,
256
+ ,
257
+ ,
258
+ ,
259
+ ,
260
+ ,
261
+ ,
262
+ ,
263
+ ,
264
+ ,
265
+ ,
266
+ ,
267
+ ,
268
+ ,
269
+ ,
270
+ ,
271
+ ,
272
+ ,
273
+ ,
274
+ ,
275
+ ,
276
+ ,
277
+ ,
278
+ ,
279
+ ,
280
+ ,
281
+ ,
282
+ ,
283
+ ,
284
+ ,
285
+ ,
286
+ ,
287
+ ,
288
+ ,
289
+ ,
290
+ ,
291
+ ,
292
+ ,
293
+ ,
294
+ ,
295
+ ,
296
+ ,
297
+ ,
298
+ ,
299
+ ,
300
+ ,
301
+ ,
302
+ ,
303
+ ,
304
+ ,
305
+ ,
306
+ ,
307
+ ,
308
+ ,
309
+ ,
310
+ ,
311
+ ,
312
+ ,
313
+ ,
314
+ ,
315
+ ,
316
+ ,
317
+ ,
318
+ ,
319
+ ,
320
+ ,
321
+ ,
322
+ ,
323
+ ,
324
+ ,
325
+ ,
326
+ ,
327
+ ,
328
+ ,
329
+ ,
330
+ ,
331
+ ,
332
+ ,
333
+ ,
334
+ ,
335
+ ,
336
+ ,
337
+ ,
338
+ ,
339
+ ,
340
+ ,
341
+ ,
342
+ ,
343
+ ,
344
+ ,
345
+ ,
346
+ ,
347
+ ,
348
+ ,
349
+ ,
350
+ ,
351
+ ,
352
+ ,
353
+ ,
354
+ ,
355
+ ,
356
+ ,
357
+ ,
358
+ ,
359
+ ,
360
+ ,
361
+ ,
362
+ ,
363
+ ,
364
+ ,
365
+ ,
366
+ ,
367
+ ,
368
+ ,
369
+ ,
370
+ ,
371
+ ,
372
+ ,
373
+ ,
374
+ ,
375
+ ,
376
+ ,
377
+ ,
378
+ ,
379
+ ,
380
+ ,
381
+ ,
382
+ ,
383
+ ,
384
+ ,
385
+ ,
386
+ ,
387
+ ,
388
+ ,
389
+ ,
390
+ ,
391
+ ,
392
+ ,
393
+ ,
394
+ ,
395
+ ,
396
+ ,
397
+ ,
398
+ ,
399
+ ,
400
+ ,
401
+ ,
402
+ ,
403
+ ,
404
+ ,
405
+ ,
406
+ ,
407
+ ,
408
+ ,
409
+ ,
410
+ ,
411
+ ,
412
+ ,
413
+ ,
414
+ ,
415
+ ,
416
+ ,
417
+ ,
418
+ ,
419
+ ,
420
+ ,
421
+ ,
422
+ ,
423
+ ,
424
+ ,
425
+ ,
426
+ ,
427
+ ,
428
+ ,
429
+ ,
430
+ ,
431
+ ,
432
+ ,
433
+ ,
434
+ ,
435
+ ,
436
+ ,
437
+ ,
438
+ ,
439
+ ,
440
+ ,
441
+ ,
442
+ ,
443
+ ,
444
+ ,
445
+ ,
446
+ ,
447
+ ,
448
+ ,
449
+ ,
450
+ ,
451
+ ,
452
+ ,
453
+ ,
454
+ ,
455
+ ,
456
+ ,
457
+ ,
458
+ ,
459
+ ,
460
+ ,
461
+ ,
462
+ ,
463
+ ,
464
+ ,
465
+ ,
466
+ ,
467
+ ,
468
+ ,
469
+ ,
470
+ ,
471
+ ,
472
+ ,
473
+ ,
474
+ ,
475
+ ,
476
+ ,
477
+ ,
478
+ ,
479
+ ,
480
+ ,
481
+ ,
482
+ ,
483
+ ,
484
+ ,
485
+ ,
486
+ ,
487
+ ,
488
+ ,
489
+ ,
490
+ ,
491
+ ,
492
+ ,
493
+ ,
494
+ ,
495
+ ,
496
+ ,
497
+ ,
498
+ ,
499
+ ,
500
+ ,
501
+ ,
502
+ ,
503
+ ,
504
+ ,
505
+ ,
506
+ ,
507
+ ,
508
+ ,
509
+ ,
510
+ ,
511
+ ,
512
+ ,
513
+ ,
514
+ ,
515
+ ,
516
+ ,
517
+ ,
518
+ ,
519
+ ,
520
+ ,
521
+ ,
522
+ ,
523
+ ,
524
+ ,
525
+ ,
526
+ ,
527
+ ,
528
+ ,
529
+ ,
530
+ ,
531
+ ,
532
+ ,
533
+ ,
534
+ ,
535
+ ,
536
+ ,
537
+ ,
538
+ ,
539
+ ,
540
+ ,
541
+ ,
542
+ ,
543
+ ,
544
+ ,
545
+ ,
546
+ ,
547
+ ,
548
+ ,
549
+ ,
550
+ ,
551
+ ,
552
+ ,
553
+ ,
554
+ ,
555
+ ,
556
+ ,
557
+ ,
558
+ ,
559
+ ,
560
+ ,
561
+ ,
562
+ ,
563
+ ,
564
+ ,
565
+ ,
566
+ ,
567
+ ,
568
+ ,
569
+ ,
570
+ ,
571
+ ,
572
+ ,
573
+ ,
574
+ ,
575
+ ,
576
+ ,
577
+ ,
578
+ ,
579
+ ,
580
+ ,
581
+ ,
582
+ ,
583
+ ,
584
+ ,
585
+ ,
586
+ ,
587
+ ,
588
+ ,
589
+ ,
590
+ ,
591
+ ,
592
+ ,
593
+ ,
594
+ ,
595
+ ,
596
+ ,
597
+ ,
598
+ ,
599
+ ,
600
+ ,
601
+ ,
602
+ ,
603
+ ,
604
+ ,
605
+ ,
606
+ ,
607
+ ,
608
+ ,
609
+ ,
610
+ ,
611
+ ,
612
+ ,
613
+ ,
614
+ ,
615
+ ,
616
+ ,
617
+ ,
618
+ ,
619
+ ,
620
+ ,
621
+ ,
622
+ ,
623
+ ,
624
+ ,
625
+ ,
626
+ ,
627
+ ,
628
+ ,
629
+ ,
630
+ ,
631
+ ,
632
+ ,
633
+ ,
634
+ ,
635
+ ,
636
+ ,
637
+ ,
638
+ ,
639
+ ,
640
+ ,
641
+ ,
642
+ ,
643
+ ,
644
+ ,
645
+ ,
646
+ ,
647
+ ,
648
+ ,
649
+ ,
650
+ ,
651
+ ,
652
+ ,
653
+ ,
654
+ ,
655
+ ,
656
+ ,
657
+ ,
658
+ ,
659
+ ,
660
+ ,
661
+ ,
662
+ ,
663
+ ,
664
+ ,
665
+ ,
666
+ ,
667
+ ,
668
+ ,
669
+ ,
670
+ ,
671
+ ,
672
+ ,
673
+ ,
674
+ ,
675
+ ,
676
+ ,
677
+ ,
678
+ ,
679
+ ,
680
+ ,
681
+ ,
682
+ ,
683
+ ,
684
+ ,
685
+ ,
686
+ ,
687
+ ,
688
+ ,
689
+ ,
690
+ ,
691
+ ,
692
+ ,
693
+ ,
694
+ ,
695
+ ,
696
+ ,
697
+ ,
698
+ ,
699
+ ,
700
+ ,
701
+ ,
702
+ ,
703
+ ,
704
+ ,
705
+ ,
706
+ ,
707
+ ,
708
+ ,
709
+ ,
710
+ ,
711
+ ,
712
+ ,
713
+ ,
714
+ ,
715
+ ,
716
+ ,
717
+ ,
718
+ ,
719
+ ,
720
+ ,
721
+ ,
722
+ ,
723
+ ,
724
+ ,
725
+ ,
726
+ ,
727
+ ,
728
+ ,
729
+ ,
730
+ ,
731
+ ,
732
+ ,
733
+ ,
734
+ ,
735
+ ,
736
+ ,
737
+ ,
738
+ ,
739
+ ,
740
+ ,
741
+ ,
742
+ ,
743
+ ,
744
+ ,
745
+ ,
746
+ ,
747
+ ,
748
+ ,
749
+ ,
750
+ ,
751
+ ,
752
+ ,
753
+ ,
754
+ ,
755
+ ,
756
+ ,
757
+ ,
758
+ ,
759
+ ,
760
+ ,
761
+ ,
762
+ ,
763
+ ,
764
+ ,
765
+ ,
766
+ ,
767
+ ,
768
+ ,
769
+ ,
770
+ ,
771
+ ,
772
+ ,
773
+ ,
774
+ ,
775
+ ,
776
+ ,
777
+ ,
778
+ ,
779
+ ,
780
+ ,
781
+ ,
782
+ ,
783
+ ,
784
+ ,
785
+ ,
786
+ ,
787
+ ,
788
+ ,
789
+ ,
790
+ ,
791
+ ,
792
+ ,
793
+ ,
794
+ ,
795
+ ,
796
+ ,
797
+ ,
798
+ ,
799
+ ,
800
+ ,
801
+ ,
802
+ ,
803
+ ,
804
+ ,
805
+ ,
806
+ ,
807
+ ,
808
+ ,
809
+ ,
810
+ ,
811
+ ,
812
+ ,
813
+ ,
814
+ ,
815
+ ,
816
+ ,
817
+ ,
818
+ ,
819
+ ,
820
+ ,
821
+ ,
822
+ ,
823
+ ,
824
+ ,
825
+ ,
826
+ ,
827
+ ,
828
+ ,
829
+ ,
830
+ ,
831
+ ,
832
+ ,
833
+ ,
834
+ ,
835
+ ,
836
+ ,
837
+ ,
838
+ ,
839
+ ,
840
+ ,
841
+ ,
842
+ ,
843
+ ,
844
+ ,
845
+ ,
846
+ ,
847
+ ,
848
+ ,
849
+ ,
850
+ ,
851
+ ,
852
+ ,
853
+ ,
854
+ ,
855
+ ,
856
+ ,
857
+ ,
858
+ ,
859
+ ,
860
+ ,
861
+ ,
862
+ ,
863
+ ,
864
+ ,
865
+ ,
866
+ ,
867
+ ,
868
+ ,
869
+ ,
870
+ ,
871
+ ,
872
+ ,
873
+ ,
874
+ ,
875
+ ,
876
+ ,
877
+ ,
878
+ ,
879
+ ,
880
+ ,
881
+ ,
882
+ ,
883
+ ,
884
+ ,
885
+ ,
886
+ ,
887
+ ,
888
+ ,
889
+ ,
890
+ ,
891
+ ,
892
+ ,
893
+ ,
894
+ ,
895
+ ,
896
+ ,
897
+ ,
898
+ ,
899
+ ,
900
+ ,
901
+ ,
902
+ ,
903
+ ,
904
+ ,
905
+ ,
906
+ ,
907
+ ,
908
+ ,
909
+ ,
910
+ ,
911
+ ,
912
+ ,
913
+ ,
914
+ ,
915
+ ,
916
+ ,
917
+ ,
918
+ ,
919
+ ,
920
+ ,
921
+ ,
922
+ ,
923
+ ,
924
+ ,
925
+ ,
926
+ ,
927
+ ,
928
+ ,
929
+ ,
930
+ ,
931
+ ,
932
+ ,
933
+ ,
934
+ ,
935
+ ,
936
+ ,
937
+ ,
938
+ ,
939
+ ,
940
+ ,
941
+ ,
942
+ ,
943
+ ,
944
+ ,
945
+ ,
946
+ ,
947
+ ,
948
+ ,
949
+ ,
950
+ ,
951
+ ,
952
+ ,
953
+ ,
954
+ ,
955
+ ,
956
+ ,
957
+ ,
958
+ ,
959
+ ,
960
+ ,
961
+ ,
962
+ ,
963
+ ,
964
+ ,
965
+ ,
966
+ ,
967
+ ,
968
+ ,
969
+ ,
970
+ ,
971
+ ,
972
+ ,
973
+ ,
974
+ ,
975
+ ,
976
+ ,
977
+ ,
978
+ ,
979
+ ,
980
+ ,
981
+ ,
982
+ ,
983
+ ,
984
+ ,
985
+ ,
986
+ ,
987
+ ,
988
+ ,
989
+ ,
990
+ ,
991
+ ,
992
+ ,
993
+ ,
994
+ ,
995
+ ,
996
+ ,
997
+ ,
998
+ ,
999
+ ,
1000
+ ,
1001
+ ,
1002
+ ,
1003
+ ,
1004
+ ,
1005
+ ,
1006
+ ,
1007
+ ,
1008
+ ,
1009
+ ,
1010
+ ,
1011
+ ,
1012
+ ,
1013
+ ,
1014
+ ,
1015
+ ,
1016
+ ,
1017
+ ,
1018
+ ,
1019
+ ,
1020
+ ,
1021
+ ,
1022
+ ,
1023
+ ,
1024
+ ,
1025
+ ,
1026
+ ,
1027
+ ,
1028
+ ,
1029
+ ,
data/qa_data.json ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "question": "「地域学校協働活動」とは何ですか?",
4
+ "answer": "地域と学校がパートナーとなり、地域全体で子供たちの成長を支え、地域を創生する活動です。"
5
+ },
6
+ {
7
+ "question": "なぜ地域学校協働活動を推進する必要があるのですか?",
8
+ "answer": "地域における教育力の低下、家庭の孤立化などの課題や、学校を取り巻く問題の複雑化・困難化に対して社会総掛かりで対応することが求められています。そのためには、地域と学校がパートナーとして連携・協働するための組織的・継続的な仕組みが必要不可欠です。また、新学習指導要領が目指す「社会に開かれた教育課程」の実現に向けて、学校は地域との連携・協働を一層進めていくことが重要であり、より多くの住民等が子供たちの成長を支える活動に参画するための基盤整備していくことが求められています。こうした背景を踏まえ、平成29年3月に社会教育法が改正されました。"
9
+ },
10
+ {
11
+ "question": "「地域学校協働活動」によりどのような効果があるのですか?",
12
+ "answer": "アンケートによれば、子供たち・学校・地域へ様々な効果があったとの回答が得られています。\n・子供たちへの効果:地域住民と交流することにより、様々な体験や経験の場が増え、「コミュニケーション能力の向上につながった」「地域への理解・関心が深まった」\n・学校への効果:「教員が授業や生徒指導などにより力を注ぐことができた」\n・地域への効果:「地域の活性化につながった」「生きがいづくりや自己実現につながった」\nまた、東日本大震災時に自治組織の立ち上げが順調だったとの回答も得られました。\n(平成27年度地域学校協働活動の実施状況アンケート調査(文部科学省・国立教育政策研究所))"
13
+ },
14
+ {
15
+ "question": "「地域学校協働本部」とは何ですか?",
16
+ "answer": "平成27年12月の中央教育審議会答申において、従来「学校支援地域本部」等の活動を基盤として、地域による学校の「支援」から、地域と学校双方向の連携・協働へ、また「個別の活動」から活動の「総合化・ネットワーク」を目指し、幅広い地域住民の参画により、地域学校協働活動を推進する新たな体制として提言されたものです。"
17
+ },
18
+ {
19
+ "question": "地域学校協働活動の推進により、教職員の負担が増えるのではないですか?",
20
+ "answer": "地域学校協働活動のスタートアップの時点では教職員へ負担が大きいという声もあります。しかしながら、学校のみならず住民や保護者も含めた社会総掛かりでの教育の実現を目指すものであり、教職員の負担軽減にも資するものと考えられます。"
21
+ },
22
+ {
23
+ "question": "地域学校協働活動についての国はどのような目標を掲げているのですか?",
24
+ "answer": "地域学校協働活動について、以下のような目標を掲げています。\n・2022年度までに、全小中学校区をカバーして地域協働活動を推進\n(働き方改革実行計画(平成29年3月28日 働き方改革実現会議決定))\n・2022年度までに、全小中学校区をカバーして地域協働本部を設置\n(ニッポン一億総活躍プラン(平成28年6月2日閣議決定))"
25
+ },
26
+ {
27
+ "question": "地域学校協働活動に対する国の財政的な支援はありますか?",
28
+ "answer": "文部科学省では、地域学校協働活動の全国的な推進のため平成29年度より「地域学校協働活動推進事業」(令和2年度からは「地域と学校の連携・協働体制構築事業」に名称変更)を実施しています。本事業は、自治体における地域学校協働活動の実施に関し、国庫負担1/3の割合で補助することを目的としており、地域と学校をつなぐコーディネーターとしての役割を果たす地域学校協働活動推進員や、活動を行うボランティア等への謝金、自治体が実施する研修会等に係る経費を計上しています。"
29
+ },
30
+ {
31
+ "question": "「地域学校協働活動」と「学校運営協議会」との関係は?学校運営協議会だけで十分では?",
32
+ "answer": "学校運営協議会は協議の場です。学校運営協議会において、学校運営への必要な支援について協議が行われ、その結果を踏まえて、より円滑かつ効果的に地域学校協働活動を行うことにより、教育活動の充実や教職員の負担軽減など、学校運営改善に結びつけることが重要で��。"
33
+ },
34
+ {
35
+ "question": "コミュニティ・スクールとは何ですか?",
36
+ "answer": "「学校運営協議会制度」又は「学校運営協議会制度を導入した学校」のことです。コミュニティ・スクールは学校と地域住民等が力を合わせて学校の運営に取り組むことが可能となる「地域とともにある学校づくり」への転換を図るための有効な仕組みです。"
37
+ },
38
+ {
39
+ "question": "「学校運営協議会」とは何ですか?",
40
+ "answer": "学校と地域住民や保護者等が学校運営の基本方針の承認や様々な課題の共有を図るともに、学校運営への必要な支援等について協議する場です。(地方教育行政の組織及び運営に関する法律第47条の5、下記の「関係法令について」を参照)"
41
+ },
42
+ {
43
+ "question": "「コミュニティ・スクール」の役割は何ですか?",
44
+ "answer": "学校運営協議会の主な役割は以下のとおりです。\n・校長が作成する学校運営の基本方針を承認する。\n・学校運営について、教育委員会又は校長に意見を述べることができる。\n・教職員の任用に関して、教育委員会規則に定める事項について、教育委員会に意見を述べることができる。"
45
+ },
46
+ {
47
+ "question": "コミュニティ・スクールでは、教育委員会や校長に自由に意見を言えるのですか?",
48
+ "answer": "教育委員会や校長に意見を述べるときは、個人の意見がそのまま尊重されるのではなく、保護者や地域住民等の代表による\"合議体\"としての意見を述べることになります。"
49
+ },
50
+ {
51
+ "question": "「地域とともにある学校」には何が必要ですか?",
52
+ "answer": "学校運営協議会で行う協議に加え、熟議・協働・マネジメントの3つの視点をもって、「情報の共有→課題・目標・ビジョンの共有→アクションの共有→成功体験の共有」の共有の好循環を作ることが重要です。"
53
+ },
54
+ {
55
+ "question": "熟議・協働・マネジメントとは何ですか?",
56
+ "answer": "・熟議:多くの当事者により「熟慮」と「議論」を重ねながら課題解決を目指す対話のことです。当事者としては、保護者・教職員・地域住民等が含まれます。\n・協働:同じ目的・目標に向かって、対等の立場で協力して共に働くことです。保護者や地域住民が計画段階から参画し、課題や目標等を共有したうえで、目標に向けた取組を進めます。\n・マネジメント:校長は、校務をつかさどり、所属職員を監督します。コミュニティ・スクールの運営には校長の強いリーダーシップが必要です。"
57
+ },
58
+ {
59
+ "question": "最近の関連する法律の改正について教えてください。",
60
+ "answer": "平成27年12月の中央教育審議会の答申を踏まえ、平成29年3月に社会教育法と地方教育行政の組織及び運営に関する法律第47条の6が改正され、平成29年4月に施行されました。(※令和2年4月1日より、第47条の5)\n\n(1)社会教育法\n・地域学校協働活動を推進する際に、教育委員会が地域と学校との連携協力体制を整備しました。\n・地域と学校をつなぐ役割を担う地域学校協働活動推進員の委嘱に関する規定を整備しました。\n\n(2)地方教育行政の組織及び運営に関する法律第47条の6(※令和2年4月1日より、第47条の5)\n・各教育委員会に対して学校運営協議会の設置が教育委員会の努力義務化されました。"
61
+ },
62
+ {
63
+ "question": "地域の住民が、学校のためにボランティアとして参加するにはどうしたら良いですか?",
64
+ "answer": "各地方自治体やNPO法人等にご相談ください。"
65
+ },
66
+ {
67
+ "question": "企業やNPO団体が、学校との連携・協働に参加するにはどうしたら良いですか?",
68
+ "answer": "「土曜学習応援団」へ賛同・登録ください。トップ頁の「企業等による教育プログラム」又は「企業・団体の方」をご覧く"
69
+ },
70
+ {
71
+ "question": "土曜学習応援団とは何ですか?",
72
+ "answer": "子供たちの豊かな学びを支えるために、多様な企業・団体・大学等に「土曜学習応援団」にご賛同(ご参画)・登録いただき、出前授業・施設見学などにより、特色・魅力ある教育活動をしていただいています。提供していただいた教育プログラムはWEB上で検索可能です。学校・教育委員会・コーディネーター・保護者などに教育プログラムを検索していただき、平日の授業や放課後、土日祝祭日等に出前授業等を行っていただくことができます。"
73
+ },
74
+ {
75
+ "question": "土曜学習応援団の学習プログラムは土曜日に実施する・されるのですか?",
76
+ "answer": "土曜日に限定されません。平日の授業中や放課後、土曜日、日曜日、祝日などさまざまです。各教育プログラムに、実施の日を掲載しています。実際の実施日時は、各企業・団体等と、学校等とが相談して決めることができます。"
77
+ },
78
+ {
79
+ "question": "どのような学習プログラムが登録されていますか?",
80
+ "answer": "理科・実験、体育・スポーツ、音楽、美術、社会、プログラミングなどの学校の授業の教科に関連したプログラムや、キャリア教育、環境、金融・経済、安全・防災、国際理解などの教科横断型のプログラムがあります。"
81
+ },
82
+ {
83
+ "question": "土曜学習応援団に賛同・登録しているのはどのような企業・団体ですか?",
84
+ "answer": "一般企業、NPO法人、大学、各種組合、専門学校等、さまざまです。800以上の企業等が登録しています。"
85
+ },
86
+ {
87
+ "question": "企業・団体・大学等が、土曜学習応援団に賛同・登録するメリットは何ですか?",
88
+ "answer": "自社の技術・知識を活かして、社会に貢献できます。経営のトップが、SDGs、ESD、CSRなどを意識するようになり、企業の価値評価にも利用されるようになってきております。出前授業を通じて、社員の自社製品に対する理解やモチベーションアップにも繋がります。"
89
+ }
90
+ ]
data/question_embeddings.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45127b6e8615f93324b2debb37305b93d3963c5f91f054f9c56def8cd00c1ca5
3
+ size 67712
data/raw.json ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "question": "「地域学校協働活動」とは何ですか?",
4
+ "answer": "地域と学校がパートナーとなり、地域全体で子供たちの成長を支え、地域を創生する活動です。"
5
+ },
6
+ {
7
+ "question": "なぜ地域学校協働活動を推進する必要があるのですか?",
8
+ "answer": "地域における教育力の低下、家庭の孤立化などの課題や、学校を取り巻く問題の複雑化・困難化に対して社会総掛かりで対応することが求められています。そのためには、地域と学校がパートナーとして連携・協働するための組織的・継続的な仕組みが必要不可欠です。また、新学習指導要領が目指す「社会に開かれた教育課程」の実現に向けて、学校は地域との連携・協働を一層進めていくことが重要であり、より多くの住民等が子供たちの成長を支える活動に参画するための基盤整備していくことが求められています。こうした背景を踏まえ、平成29年3月に社会教育法が改正されました。"
9
+ },
10
+ {
11
+ "question": "「地域学校協働活動」によりどのような効果があるのですか?",
12
+ "answer": "アンケートによれば、子供たち・学校・地域へ様々な効果があったとの回答が得られています。\n・子供たちへの効果:地域住民と交流することにより、様々な体験や経験の場が増え、「コミュニケーション能力の向上につながった」「地域への理解・関心が深まった」\n・学校への効果:「教員が授業や生徒指導などにより力を注ぐことができた」\n・地域への効果:「地域の活性化につながった」「生きがいづくりや自己実現につながった」\nまた、東日本大震災時に自治組織の立ち上げが順調だったとの回答も得られました。\n(平成27年度地域学校協働活動の実施状況アンケート調査(文部科学省・国立教育政策研究所))"
13
+ },
14
+ {
15
+ "question": "「地域学校協働本部」とは何ですか?",
16
+ "answer": "平成27年12月の中央教育審議会答申において、従来「学校支援地域本部」等の活動を基盤として、地域による学校の「支援」から、地域と学校双方向の連携・協働へ、また「個別の活動」から活動の「総合化・ネットワーク」を目指し、幅広い地域住民の参画により、地域学校協働活動を推進する新たな体制として提言されたものです。"
17
+ },
18
+ {
19
+ "question": "地域学校協働活動の推進により、教職員の負担が増えるのではないですか?",
20
+ "answer": "地域学校協働活動のスタートアップの時点では教職員へ負担が大きいという声もあります。しかしながら、学校のみならず住民や保護者も含めた社会総掛かりでの教育の実現を目指すものであり、教職員の負担軽減にも資するものと考えられます。"
21
+ },
22
+ {
23
+ "question": "地域学校協働活動についての国はどのような目標を掲げているのですか?",
24
+ "answer": "地域学校協働活動について、以下のような目標を掲げています。\n・2022年度までに、全小中学校区をカバーして地域協働活動を推進\n(働き方改革実行計画(平成29年3月28日 働き方改革実現会議決定))\n・2022年度までに、全小中学校区をカバーして地域協働本部を設置\n(ニッポン一億総活躍プラン(平成28年6月2日閣議決定))"
25
+ },
26
+ {
27
+ "question": "地域学校協働活動に対する国の財政的な支援はありますか?",
28
+ "answer": "文部科学省では、地域学校協働活動の全国的な推進のため平成29年度より「地域学校協働活動推進事業」(令和2年度からは「地域と学校の連携・協働体制構築事業」に名称変更)を実施しています。本事業は、自治体における地域学校協働活動の実施に関し、国庫負担1/3の割合で補助することを目的としており、地域と学校をつなぐコーディネーターとしての役割を果たす地域学校協働活動推進員や、活動を行うボランティア等への謝金、自治体が実施する研修会等に係る経費を計上しています。"
29
+ },
30
+ {
31
+ "question": "「地域学校協働活動」と「学校運営協議会」との関係は?学校運営協議会だけで十分では?",
32
+ "answer": "学校運営協議会は協議の場です。学校運営協議会において、学校運営への必要な支援について協議が行われ、その結果を踏まえて、より円滑かつ効果的に地域学校協働活動を行うことにより、教育活動の充実や教職員の負担軽減など、学校運営改善に結びつけることが重要で��。"
33
+ },
34
+ {
35
+ "question": "コミュニティ・スクールとは何ですか?",
36
+ "answer": "「学校運営協議会制度」又は「学校運営協議会制度を導入した学校」のことです。コミュニティ・スクールは学校と地域住民等が力を合わせて学校の運営に取り組むことが可能となる「地域とともにある学校づくり」への転換を図るための有効な仕組みです。"
37
+ },
38
+ {
39
+ "question": "「学校運営協議会」とは何ですか?",
40
+ "answer": "学校と地域住民や保護者等が学校運営の基本方針の承認や様々な課題の共有を図るともに、学校運営への必要な支援等について協議する場です。(地方教育行政の組織及び運営に関する法律第47条の5、下記の「関係法令について」を参照)"
41
+ },
42
+ {
43
+ "question": "「コミュニティ・スクール」の役割は何ですか?",
44
+ "answer": "学校運営協議会の主な役割は以下のとおりです。\n・校長が作成する学校運営の基本方針を承認する。\n・学校運営について、教育委員会又は校長に意見を述べることができる。\n・教職員の任用に関して、教育委員会規則に定める事項について、教育委員会に意見を述べることができる。"
45
+ },
46
+ {
47
+ "question": "コミュニティ・スクールでは、教育委員会や校長に自由に意見を言えるのですか?",
48
+ "answer": "教育委員会や校長に意見を述べるときは、個人の意見がそのまま尊重されるのではなく、保護者や地域住民等の代表による\"合議体\"としての意見を述べることになります。"
49
+ },
50
+ {
51
+ "question": "「地域とともにある学校」には何が必要ですか?",
52
+ "answer": "学校運営協議会で行う協議に加え、熟議・協働・マネジメントの3つの視点をもって、「情報の共有→課題・目標・ビジョンの共有→アクションの共有→成功体験の共有」の共有の好循環を作ることが重要です。"
53
+ },
54
+ {
55
+ "question": "熟議・協働・マネジメントとは何ですか?",
56
+ "answer": "・熟議:多くの当事者により「熟慮」と「議論」を重ねながら課題解決を目指す対話のことです。当事者としては、保護者・教職員・地域住民等が含まれます。\n・協働:同じ目的・目標に向かって、対等の立場で協力して共に働くことです。保護者や地域住民が計画段階から参画し、課題や目標等を共有したうえで、目標に向けた取組を進めます。\n・マネジメント:校長は、校務をつかさどり、所属職員を監督します。コミュニティ・スクールの運営には校長の強いリーダーシップが必要です。"
57
+ },
58
+ {
59
+ "question": "最近の関連する法律の改正について教えてください。",
60
+ "answer": "平成27年12月の中央教育審議会の答申を踏まえ、平成29年3月に社会教育法と地方教育行政の組織及び運営に関する法律第47条の6が改正され、平成29年4月に施行されました。(※令和2年4月1日より、第47条の5)\n\n(1)社会教育法\n・地域学校協働活動を推進する際に、教育委員会が地域と学校との連携協力体制を整備しました。\n・地域と学校をつなぐ役割を担う地域学校協働活動推進員の委嘱に関する規定を整備しました。\n\n(2)地方教育行政の組織及び運営に関する法律第47条の6(※令和2年4月1日より、第47条の5)\n・各教育委員会に対して学校運営協議会の設置が教育委員会の努力義務化されました。"
61
+ },
62
+ {
63
+ "question": "地域の住民が、学校のためにボランティアとして参加するにはどうしたら良いですか?",
64
+ "answer": "各地方自治体やNPO法人等にご相談ください。"
65
+ },
66
+ {
67
+ "question": "企業やNPO団体が、学校との連携・協働に参加するにはどうしたら良いですか?",
68
+ "answer": "「土曜学習応援団」へ賛同・登録ください。トップ頁の「企業等による教育プログラム」又は「企業・団体の方」をご覧く"
69
+ },
70
+ {
71
+ "question": "土曜学習応援団とは何ですか?",
72
+ "answer": "子供たちの豊かな学びを支えるために、多様な企業・団体・大学等に「土曜学習応援団」にご賛同(ご参画)・登録いただき、出前授業・施設見学などにより、特色・魅力ある教育活動をしていただいています。提供していただいた教育プログラムはWEB上で検索可能です。学校・教育委員会・コーディネーター・保護者などに教育プログラムを検索していただき、平日の授業や放課後、土日祝祭日等に出前授業等を行っていただくことができます。"
73
+ },
74
+ {
75
+ "question": "土曜学習応援団の学習プログラムは土曜日に実施する・されるのですか?",
76
+ "answer": "土曜日に限定されません。平日の授業中や放課後、土曜日、日曜日、祝日などさまざまです。各教育プログラムに、実施の日を掲載しています。実際の実施日時は、各企業・団体等と、学校等とが相談して決めることができます。"
77
+ },
78
+ {
79
+ "question": "どのような学習プログラムが登録されていますか?",
80
+ "answer": "理科・実験、体育・スポーツ、音楽、美術、社会、プログラミングなどの学校の授業の教科に関連したプログラムや、キャリア教育、環境、金融・経済、安全・防災、国際理解などの教科横断型のプログラムがあります。"
81
+ },
82
+ {
83
+ "question": "土曜学習応援団に賛同・登録しているのはどのような企業・団体ですか?",
84
+ "answer": "一般企業、NPO法人、大学、各種組合、専門学校等、さまざまです。800以上の企業等が登録しています。"
85
+ },
86
+ {
87
+ "question": "企業・団体・大学等が、土曜学習応援団に賛同・登録するメリットは何ですか?",
88
+ "answer": "自社の技術・知識を活かして、社会に貢献できます。経営のトップが、SDGs、ESD、CSRなどを意識するようになり、企業の価値評価にも利用されるようになってきております。出前授業を通じて、社員の自社製品に対する理解やモチベーションアップにも繋がります。"
89
+ }
90
+ ]
main.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import uvicorn
2
+ from fastapi import FastAPI
3
+ from fastapi.middleware.cors import CORSMiddleware
4
+ from contextlib import asynccontextmanager
5
+
6
+ from app.routes.embedding_routes import router as embedding_router
7
+ from app.routes.prediction_routes import router as prediction_router
8
+ from app.services.model_service import initialize_model, load_embeddings
9
+
10
+
11
+ @asynccontextmanager
12
+ async def lifespan(app: FastAPI):
13
+ """
14
+ Initialize model and load embeddings when the application starts.
15
+ """
16
+ print("Initializing model...")
17
+ initialize_model()
18
+
19
+ print("Loading embeddings...")
20
+ question_embeddings, answer_embeddings, qa_data = load_embeddings()
21
+
22
+ if (
23
+ question_embeddings is not None
24
+ and answer_embeddings is not None
25
+ and qa_data is not None
26
+ ):
27
+ print(f"Embeddings loaded successfully. {len(qa_data)} QA pairs available.")
28
+ else:
29
+ print(
30
+ "No embeddings found. Please use the /api/create-embeddings endpoint to create embeddings."
31
+ )
32
+
33
+ yield
34
+ # Cleanup code (if any) would go here
35
+
36
+
37
+ app = FastAPI(
38
+ title="Taiken Chatbot API",
39
+ description="API for embedding creation and answer prediction",
40
+ version="1.0.0",
41
+ lifespan=lifespan,
42
+ )
43
+
44
+ # Add CORS middleware
45
+ app.add_middleware(
46
+ CORSMiddleware,
47
+ allow_origins=["*"],
48
+ allow_credentials=True,
49
+ allow_methods=["*"],
50
+ allow_headers=["*"],
51
+ )
52
+
53
+ # Include routers
54
+ app.include_router(embedding_router, prefix="/api", tags=["Embedding"])
55
+ app.include_router(prediction_router, prefix="/api", tags=["Prediction"])
56
+
57
+
58
+ @app.get("/", tags=["Health"])
59
+ async def root():
60
+ return {"message": "Hello World"}
61
+
62
+ if __name__ == "__main__":
63
+ uvicorn.run(app, host="0.0.0.0", port=8000, reload=True)
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ fastapi
2
+ uvicorn
3
+ pandas
4
+ numpy
5
+ sentence-transformers[onnx]
6
+ python-multipart
7
+ openpyxl